This commit completely overhauls the heading navigation feature (d/shift+D keys)
to use actual HTML tag information instead of unreliable text-based heuristics.
Key improvements:
- Navigation now works 100% reliably by tracking actual <h1>-<h6> HTML tags
- Eliminates false positives from bold text, links, and buttons
- No longer navigates to blank lines around headings
- Provides true screen reader-style heading navigation
Technical implementation:
- Added LINE_FLAG_HEADING flag to mark heading lines during HTML processing
- Enhanced readbuffer with in_heading field to track heading tag state
- Modified HTML parser to set/clear heading flags on <h>/<\/h> tags
- Updated TextLine and Line structures to preserve heading information
- Simplified navigation functions to use reliable flag-based detection
- Added content length check to avoid marking blank spacing lines
Also includes compilation fixes for modern GCC:
- Fixed function pointer type compatibility issues
- Updated signal handler declarations
- Resolved deprecation warnings for various system calls
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Remove old-style extern declaration that conflicts with stdlib.h.
Continues modernization for GCC compatibility.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Remove old-style extern declaration that conflicts with stdlib.h.
This fixes compilation error with modern GCC versions.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Commit 419ca82d57 (Fix m17n backspace handling causes out-of-bounds
write in checkType) introduced an incomplete fix.
In function checkType we store the length of the previous multi-char
character in a buffer plens_buffer with pointer plens pointing to the
current position inside the buffer. When encountering a backspace plens
is set to the previous position without a bounds check. This will lead
to plens being out of bounds if we get more backspaces than we have
processed multi-char characters before.
If we are at the beginning of the buffer do not decrement and set plen
(the current length) to 0.
This also fixes GH Issue #270 [BUG] Out of bound read in Strnew_size ,
Str.c:61
If the above explanation does sound weird it's because I didn't fully
grok that function. :-)
When building with gcc and -Wnull-dereference, -O3 and -flto we get a
lot of warnings about potential null dereferences. Exiting instead of
returning NULL solves all of it.
If we cannot alloc memory, there is not much to do - exiting is the
easiest option.
Introduce a separate TU for utility functions util.c. Add a function
exec_cmd to simplify execution of system commands with error handling.
While at it, suppress a warning about unused result when executing a
shell command. As we only display the command's output we do not care
about the exit code.
This fixes Debian bug #398989[0]
[0]: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=398989