don't jump to error line if cursor is nearby
claudeha opened this issue · 6 comments
Describe the bug
When editing, the error location is likely to be the last edit. Jump to error seems to move the cursor to the start of the (sometimes next) line, breaking flow if you make a typo.
Expected behavior
If the error is near the cursor, don't move it.
Desktop (please complete the following information):
- OS: Debian Bullseye
- Gfx: AMD RX 580
Additional context
Disabling jump to error globally is not desirable.
Maybe column number could be extracted from shader error log?
Column number is a good idea.
I've found that getting the line right line number is problematic, +/- 1 is caused by QOpenGLShaderProgram injecting lines into the sources. I tried my best to compensate but it doesn't seem consistent across GLSL versions ??? the result is that sometimes the line number is out by one. Could also be the result of me not quite understanding exactly why and when Qt injects extra lines.
the GLSL compiler reports column?
eg:Examples/Historical 3D Fractals/Mandelbulb.frag (90) : error C7011: implicit cast from "float" to "int"
I see only line number only as reported from shaderProgram->log()
Here with:
return c; error;
on line 68 (as reported by the editor line numbers) I get
/home/claude/FractalHelix-2.frag :69(12): error: `error' undeclared
The 12 is the column number (e of error), and the line number is off by one. Until the offset is fixed I suggest making "nearby" be fuzzy (abs(x-y)<=d
rather than x==y
).
I'm using Debian Bullseye (current testing):
Vendor: X.Org
Renderer: Radeon RX 580 Series (POLARIS10, DRM 3.39.0, 5.9.0-3-amd64, LLVM 11.0.0)
GL Driver: 4.6 (Compatibility Profile) Mesa 20.2.3
yup, fuzzy can be added if needed, I would rather figure out what is causing the off by one, can you post me the frag pak? auto saved to _Files/ with include support frags, for the most part my system does not show off by one, if those same frags show the same off by one on nVidia as on Radeon then manufacturer differences could be ruled out and I'll dig into FragM sources some more.
edit: ...and I'll poke at the glsl compiler a bit to see where the column number is hiding...
log lines look like this on my system 0(89) : error C7011: implicit cast from "int" to "float"
leading "0" is nVidia's glsl compiler file index number generated by #include directives replaced with filename by FragM, no column numbers :(