1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-11-02 08:57:19 -04:00

[ecmascript] draw_formatted(..., 3) in doc_rerender_after_document_update.

Previously, in document_replace wrong length was passed to add_fragment.
Now, I guess is correct, and testing arithmetics works for me.
This commit is contained in:
Witold Filipczyk 2022-07-13 19:10:54 +02:00
parent 267713e2c9
commit 307be32113
3 changed files with 6 additions and 14 deletions

View File

@ -1043,15 +1043,11 @@ js_document_replace(JSContext *ctx, JSValueConst this_val, int argc, JSValueCons
struct string nu_str; struct string nu_str;
if (init_string(&nu_str)) { if (init_string(&nu_str)) {
ssize_t fd_len = f->length;
string_replace(&nu_str, &f_data, &needle, &heystack); string_replace(&nu_str, &f_data, &needle, &heystack);
delete_entry_content(cached); delete_entry_content(cached);
/* This is very ugly, indeed. And Yes fd_len isn't /* TBD: somehow better rerender the document
* logically correct. But using nu_str.length will cause
* the document to render improperly.
* TBD: somehow better rerender the document
* now it's places on the session level in doc_loading_callback */ * now it's places on the session level in doc_loading_callback */
add_fragment(cached, 0, nu_str.source, fd_len); add_fragment(cached, 0, nu_str.source, nu_str.length);
normalize_cache_entry(cached, nu_str.length); normalize_cache_entry(cached, nu_str.length);
document->ecmascript_counter++; document->ecmascript_counter++;
done_string(&nu_str); done_string(&nu_str);

View File

@ -1428,15 +1428,11 @@ document_replace(JSContext *ctx, unsigned int argc, JS::Value *vp)
struct string nu_str; struct string nu_str;
if (init_string(&nu_str)) { if (init_string(&nu_str)) {
ssize_t fd_len = f->length;
string_replace(&nu_str, &f_data, &needle, &heystack); string_replace(&nu_str, &f_data, &needle, &heystack);
delete_entry_content(cached); delete_entry_content(cached);
/* This is very ugly, indeed. And Yes fd_len isn't /* TBD: somehow better rerender the document
* logically correct. But using nu_str.length will cause
* the document to render improperly.
* TBD: somehow better rerender the document
* now it's places on the session level in doc_loading_callback */ * now it's places on the session level in doc_loading_callback */
add_fragment(cached, 0, nu_str.source, fd_len); add_fragment(cached, 0, nu_str.source, nu_str.length);
normalize_cache_entry(cached, nu_str.length); normalize_cache_entry(cached, nu_str.length);
document->ecmascript_counter++; document->ecmascript_counter++;
done_string(&nu_str); done_string(&nu_str);

View File

@ -713,7 +713,7 @@ doc_rerender_after_document_update(struct session *ses) {
} }
if (ses->doc_view->document->ecmascript_counter > 0) { if (ses->doc_view->document->ecmascript_counter > 0) {
if (ses->doc_view->vs) { if (ses->doc_view->vs) {
draw_formatted(ses, 1); draw_formatted(ses, 3);
//DBG("REDRAWING..."); //DBG("REDRAWING...");
} }
} }