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>
80 lines
2.3 KiB
C
80 lines
2.3 KiB
C
/* $Id: textlist.h,v 1.6 2003/01/20 15:30:22 ukai Exp $ */
|
|
#ifndef TEXTLIST_H
|
|
#define TEXTLIST_H
|
|
#include "Str.h"
|
|
#include <limits.h>
|
|
#define GENERAL_LIST_MAX (INT_MAX / 32)
|
|
|
|
/* General doubly linked list */
|
|
|
|
typedef struct _listitem {
|
|
void *ptr;
|
|
struct _listitem *next;
|
|
struct _listitem *prev;
|
|
} ListItem;
|
|
|
|
typedef struct _generallist {
|
|
ListItem *first;
|
|
ListItem *last;
|
|
int nitem;
|
|
} GeneralList;
|
|
|
|
extern ListItem *newListItem(void *s, ListItem *n, ListItem *p);
|
|
extern GeneralList *newGeneralList(void);
|
|
extern void pushValue(GeneralList *tl, void *s);
|
|
extern void *popValue(GeneralList *tl);
|
|
extern void *rpopValue(GeneralList *tl);
|
|
extern void delValue(GeneralList *tl, ListItem *it);
|
|
extern GeneralList *appendGeneralList(GeneralList *, GeneralList *);
|
|
|
|
/* Text list */
|
|
|
|
typedef struct _textlistitem {
|
|
char *ptr;
|
|
struct _textlistitem *next;
|
|
struct _textlistitem *prev;
|
|
} TextListItem;
|
|
|
|
typedef struct _textlist {
|
|
TextListItem *first;
|
|
TextListItem *last;
|
|
int nitem;
|
|
} TextList;
|
|
|
|
#define newTextList() ((TextList *)newGeneralList())
|
|
#define pushText(tl, s) pushValue((GeneralList *)(tl), (void *)allocStr((s),-1))
|
|
#define popText(tl) ((char *)popValue((GeneralList *)(tl)))
|
|
#define rpopText(tl) ((char *)rpopValue((GeneralList *)(tl)))
|
|
#define delText(tl, i) delValue((GeneralList *)(tl), (void *)(i))
|
|
#define appendTextList(tl, tl2) ((TextList *)appendGeneralList((GeneralList *)(tl), (GeneralList *)(tl2)))
|
|
|
|
/* Line text list */
|
|
|
|
typedef struct _TextLine {
|
|
Str line;
|
|
int pos;
|
|
char is_heading;
|
|
} TextLine;
|
|
|
|
typedef struct _textlinelistitem {
|
|
TextLine *ptr;
|
|
struct _textlinelistitem *next;
|
|
struct _textlinelistitem *prev;
|
|
} TextLineListItem;
|
|
|
|
typedef struct _textlinelist {
|
|
TextLineListItem *first;
|
|
TextLineListItem *last;
|
|
int nitem;
|
|
} TextLineList;
|
|
|
|
extern TextLine *newTextLine(Str line, int pos);
|
|
extern void appendTextLine(TextLineList *tl, Str line, int pos);
|
|
#define newTextLineList() ((TextLineList *)newGeneralList())
|
|
#define pushTextLine(tl,lbuf) pushValue((GeneralList *)(tl),(void *)(lbuf))
|
|
#define popTextLine(tl) ((TextLine *)popValue((GeneralList *)(tl)))
|
|
#define rpopTextLine(tl) ((TextLine *)rpopValue((GeneralList *)(tl)))
|
|
#define appendTextLineList(tl, tl2) ((TextLineList *)appendGeneralList((GeneralList *)(tl), (GeneralList *)(tl2)))
|
|
|
|
#endif /* not TEXTLIST_H */
|