1
0
Fork 0

[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;
if (init_string(&nu_str)) {
ssize_t fd_len = f->length;
string_replace(&nu_str, &f_data, &needle, &heystack);
delete_entry_content(cached);
/* This is very ugly, indeed. And Yes fd_len isn't
* logically correct. But using nu_str.length will cause
* the document to render improperly.
* TBD: somehow better rerender the document
/* TBD: somehow better rerender the document
* 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);
document->ecmascript_counter++;
done_string(&nu_str);

View File

@ -1428,15 +1428,11 @@ document_replace(JSContext *ctx, unsigned int argc, JS::Value *vp)
struct string nu_str;
if (init_string(&nu_str)) {
ssize_t fd_len = f->length;
string_replace(&nu_str, &f_data, &needle, &heystack);
delete_entry_content(cached);
/* This is very ugly, indeed. And Yes fd_len isn't
* 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 */
add_fragment(cached, 0, nu_str.source, fd_len);
/* TBD: somehow better rerender the document
* now it's places on the session level in doc_loading_callback */
add_fragment(cached, 0, nu_str.source, nu_str.length);
normalize_cache_entry(cached, nu_str.length);
document->ecmascript_counter++;
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->vs) {
draw_formatted(ses, 1);
draw_formatted(ses, 3);
//DBG("REDRAWING...");
}
}