Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support line fragments in plain text files #331

Merged
merged 1 commit into from
Dec 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ dillo-3.2.0 [Not released yet]
- Allow image formats to be ignored with the "ignore_image_formats" option.
- Add the "link_action" option to define custom menu entries to open links
with external programs or scripts.
- Add support for line fragments in plain text files (file://foo/bar.txt#L42).
Patches: Rodrigo Arias Mallo
+- Add primitive support for SVG using the nanosvg.h library.
- Add support for ch, rem, vw, vh, vmin and vmax CSS units.
Expand Down
6 changes: 6 additions & 0 deletions src/plain.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class DilloPlain {
style::Style *widgetStyle;
size_t Start_Ofs; /* Offset of where to start reading next */
int state;
long currentLine;

DilloPlain(BrowserWindow *bw);
~DilloPlain();
Expand Down Expand Up @@ -95,6 +96,7 @@ DilloPlain::DilloPlain(BrowserWindow *p_bw)
dw = new Textblock (prefs.limit_text_width);
Start_Ofs = 0;
state = ST_SeekingEol;
currentLine = 0L;

Layout *layout = (Layout*) bw->render_layout;
// TODO (1x) No URL?
Expand Down Expand Up @@ -142,6 +144,10 @@ void DilloPlain::addLine(char *Buf, uint_t BufSize)
char buf[129];
char *end = Buf + BufSize;

currentLine++; /* Start at 1 */
sprintf(buf, "L%ld", currentLine); /* Always fits */
DW2TB(dw)->addAnchor(buf, widgetStyle);

if (BufSize > 0) {
// Limit word length to avoid X11 coordinate
// overflow with extremely long lines.
Expand Down
Loading