diff options
author | bptato <nincsnevem662@gmail.com> | 2024-02-27 17:39:58 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2024-02-27 17:44:36 +0100 |
commit | 29f4655f5c04eeabb07c7c27bd564e0b4ae896f5 (patch) | |
tree | a9a9bd63512caf886b60c0e91bf042bacc78d93d /src/server | |
parent | cf6d0df2240762a4a70edf44a89f8e5d73b0b0c0 (diff) | |
download | chawan-29f4655f5c04eeabb07c7c27bd564e0b4ae896f5.tar.gz |
buffer: reset prevStyled in switchCharset, reshape
reshape must do a render from zero, as it's a last resort for users to fixup the page on a rendering bug. switchCharset must reset prevStyled for obvious reasons (it refers to a dead document).
Diffstat (limited to 'src/server')
-rw-r--r-- | src/server/buffer.nim | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/server/buffer.nim b/src/server/buffer.nim index cfaa8b12..0b312517 100644 --- a/src/server/buffer.nim +++ b/src/server/buffer.nim @@ -59,7 +59,7 @@ import chame/tags type BufferCommand* = enum - LOAD, RENDER, WINDOW_CHANGE, FIND_ANCHOR, READ_SUCCESS, READ_CANCELED, + LOAD, FORCE_RENDER, WINDOW_CHANGE, FIND_ANCHOR, READ_SUCCESS, READ_CANCELED, CLICK, FIND_NEXT_LINK, FIND_PREV_LINK, FIND_NTH_LINK, FIND_REV_NTH_LINK, FIND_NEXT_MATCH, FIND_PREV_MATCH, GET_LINES, UPDATE_HOVER, CONNECT, CONNECT2, GOTO_ANCHOR, CANCEL, GET_TITLE, SELECT, REDIRECT_TO_FD, @@ -659,6 +659,7 @@ proc switchCharset(buffer: Buffer) = buffer.initDecoder() buffer.htmlParser.restart(buffer.charset) buffer.document = buffer.htmlParser.builder.document + buffer.prevStyled = nil const BufferSize = 16384 @@ -742,6 +743,7 @@ proc windowChange*(buffer: Buffer, attrs: WindowAttributes) {.proxy.} = buffer.prevStyled = nil if buffer.window != nil: buffer.window.attrs = attrs + buffer.do_reshape() type UpdateHoverResult* = object link*: Option[string] @@ -1207,9 +1209,9 @@ proc getTitle*(buffer: Buffer): string {.proxy.} = if buffer.document != nil: return buffer.document.title -proc render*(buffer: Buffer): int {.proxy.} = +proc forceRender*(buffer: Buffer) {.proxy.} = + buffer.prevStyled = nil buffer.do_reshape() - return buffer.lines.len proc cancel*(buffer: Buffer): int {.proxy.} = if buffer.state == bsLoaded: |