Log of #mupdf at irc.freenode.net.

Search:
 <<<Back 1 day (to 2020/01/19)Fwd 1 day (to 2020/01/21)>>>20200120 
Nickr Hey why does the back button does not exit the reader?09:40.53 
avih ator: in jsrun.c, i think js_isarrayindex considers "000" as index, yet if you do a=[1,2,3]; a["000"]=42; then it doesn't override a[0]. how come?10:02.43 
kens Nickr why would it exit ?10:03.29 
avih (i.e. i thought there's a bug at js_isarrayindex, but i can't get it to manifest)10:04.01 
ator avih: I think you're right, '000' shouldn't be true for js_isarrayindex10:26.35 
  something must've slipped through the cracks somewhere10:26.44 
  js_isarrayindex should only return true if ToString(ToUint32(P)) == P and ToUint32(P) != 2^32 - 110:27.36 
avih ator: i know "000" is not an array index, but apparently the "bug" doesn't manifest, so maybe there's no bug?10:28.05 
  yeah, i read the spec.10:28.16 
ator because we use the '000' as a string10:28.20 
  js_isarrayindex only affects setting the .length property10:28.31 
avih gotcha10:28.37 
ator var a = [1,2,3]; a['009'] = 5; print(a.length) and you'll see the bug you (inadvertently) found10:29.12 
avih (i was trying to check if String.prototype.length does strlen on each access, and somehow js_isarrayindex and noticed it could be buggy)10:29.41 
  (and noticed there's no String.prototype.length... which got me to jsrun etc)10:30.36 
ator jsR_hasproperty has a special case for String class objects10:32.48 
avih yeah, i noticed u.s.length10:34.29 
  ator: fwiw, this was for object debugging purposes where i sort the keys like this https://0x0.st/zFCw.txt10:37.07 
  and i was wondering if that'd have two redundant strlen calls10:38.01 
ator var alen = a.length; var blen = b.length; and you won't have two redundant property lookups10:39.50 
avih but i'll have two additional insertions instead :)10:41.26 
ator insertions?10:41.50 
  right, because of the inner function10:42.09 
  String(parseInt(x)) === x is also likely faster than regexes10:42.13 
avih alen and blen has to be inserted into the function vars10:42.13 
ator if you remove the inner function, the locals will be put directly on the stack10:42.32 
  as then it can use a 'fast' case for locals, when there is no risk of having to create a lexical closure or track upvalues for inner functions10:43.09 
avih your solution will take negative values too10:43.14 
ator var y = parseInt(x); y >= 0 && String(y) === x; then?10:44.11 
avih sure :)10:44.24 
ator you were worried about performance :)10:44.33 
avih not that much :)10:44.42 
  though my solution also sorts 123...<100 numbers> 567 correctly, while parseint will not. that's intentional in my code, though it's not real array index value10:46.00 
  ator: is Object.keys(new String("hello")) supposed to return [0,1,2,3,4] ?! (it does)11:10.15 
ator yes.11:11.57 
avih huh11:12.29 
  ator: fwiw, i've been experimenting with object debugging which is nicer than JSON https://0x0.st/zCsZ.txt (simple keys are unquoted, cycles are allowed, lists array keys which are not indices, functions, wrapper objects, allows undefined, possibly in one-line for small objects, etc). any comments and/or consider adding a similar thing to the mujs REPL?11:31.22 
ator avih: have you seen the 'repr' function in mujs?11:38.09 
avih no. will look at it now. i presume it's of similar purpose?11:38.32 
  hmm.. seems it's a builtin thingy?11:40.55 
ator a representation that unlike JSON is intended to be non-lossy11:42.04 
  so it can represent things that JSON can't, like Date, Number, String objects as objects11:42.23 
  still won't print array non-index properties though11:42.44 
avih hmm.. why doesn't reprstr use JSON.stringify?11:44.17 
  ator: non lossy as in you can do eval "x = " + repr(y); to reproduce y at x?11:47.54 
ator because fmtstr in json.c isn't public and in a separate file (and I don't want to pollute the namespace)11:48.01 
  yeah. it should be a more true representation than JSON which futzes Date objects to strings, and dosen't distinguish String('a') and 'a'11:48.35 
  and turns undefined into null, etc.11:48.45 
  i.e. it's just a better way to show results in the REPL than either JSON or toString will do11:49.15 
avih right. my code still doesn't distinguish Date from string either, but it does distinguish string from string object (and bool and number)11:49.21 
  hmm.. i also don't handle regex yet.11:50.32 
  nor error (both known). but i did forget bout regex.11:51.41 
  ah, i see repr was not available before mujs 1.0.611:53.11 
  in my code, if an object ends up less than 20 chars and without newlines (of sub objects) then it prints in one line instead of spanning several. i'm not convinced it's easier to read yet though11:57.24 
  ator: can i check in js the equivalent of obj->type in jsrepr.c? should i use instanceof?12:01.35 
ator instanceof follows the prototype chain, so is not fool proof12:06.31 
  but should work for most cases12:06.45 
Robin_Watts ator: I want to make Mupdf-gl add a line of text at the top of the file opening panels.12:44.42 
  (like "Select a key to sign with:" or "Select a document to open:" etc).12:44.58 
  My attempts at tweaking ui_open_file to do that are failing, largely due to my not understanding the ui_ functions, I suspect.12:45.30 
  Can you help?12:45.35 
ator Robin_Watts: in ui_open_file, after the ui_layout(T, X, NW, 2, 2); that starts the layout (pack from Top, expand X, anchor NW, pad 2x2) segment that adds the text field and file listing13:05.45 
  add a ui_label there13:05.49 
  see tor/label13:06.47 
Robin_Watts That leaves the left hand panel going all the way to the top.13:07.19 
  11 TEXT13:07.27 
  11 FILE PANEL13:07.35 
  1113:07.37 
  where 11 is the leftmost panel.13:07.44 
  I'd rather have:13:07.48 
  MY TEXT HERE13:07.52 
  11 FILE PANEL13:07.58 
  1113:08.00 
ator then see the second commit13:08.15 
  pack the label on top before starting the rest of the dialog13:08.28 
  the ui layout stuff is a bit voodoo13:08.37 
  but basically it operates on the principle of having a 'cavity' that starts with the full window13:08.51 
  then carving out slots from the cavity to add widgets13:08.59 
  the ui_layout call sets the options for where it carves out things from the cavity13:09.16 
Robin_Watts ator: Thanks.13:09.46 
ator so ui_layout(T, X, NW, 0, 0) says to take space for the next widget(s) added by taking out space from the cavity from the Top, and the X and NW jsut say how to position the widget within the allocated space if the widget is smaller than the space for it13:10.24 
  you probably want ui_layout(..., 4, 2) padding to make it look better13:12.50 
  the ui_panel function creates a sub-cavity from the carved out space13:14.50 
Robin_Watts Thanks.13:29.00 
Robin_Watts foods.13:29.04 
ator Robin_Watts: in ensure_initial_incremental_contents, if the initial contents match we don't truncate()13:40.15 
  but the second file may have the same initial content, plus a lot extra that we'd likely want to get rid of before adding our own13:40.56 
  consider it has 5k extra stuff, but we only write 1k in our file. the result would not be what we expect, having only overwritten the first 1k leaving 4k "old" data in te file13:41.24 
  oh, nvm, I misread one condition13:41.58 
sebras ator: did you see my blurbings about HiddenHorizOCR?13:59.33 
ator sebras: yeah, we still need the advance widths to be able to position the invisible text properly14:02.27 
  or find some way to fall back to the PDF object /widths all the way down through the device interface14:02.57 
  sebras: which we do, but we still warn about it14:06.24 
  a in this case harmless warning14:06.37 
  but still indicating that the file has "problems" which it does14:06.49 
Robin_Watts ator: 2 more commits pushed onto the end of that then to improve dialogues ets.14:20.05 
  etc.14:20.07 
sebras ator: I guess pdfbox are considering text drawn with rendering mode 3 means that the characters are not used, and so they choose not to complain when the character widths are not available.14:21.32 
ator Robin_Watts: cool. I'm going to nod at your branch, most of the stuff we've been over before and I spot nothing bad in the new stuff.14:25.06 
  are you sure we can't use ftruncate on windows rather than _chsize_s?14:25.37 
  since we depend on VS2015+ I mean, but maybe those POSIX functions aren't there yet14:26.29 
Robin_Watts We rely on VS2019, but that can build stuff that runs all the way back to XP.14:35.35 
  _chsize_s is there all the way back until VS2005 (so XP).14:35.59 
  so it seems safest to use that.14:36.06 
ator oh, right. we still need to use a libc compatible with winxp.14:37.28 
Robin_Watts indeed.14:37.58 
  If building for XP is a requirement, then I need to footle with the solution a bit to make configurations that use the v141_xp toolset rather than the default (142).14:38.41 
  I figured I'd worry about that when we actually get a request.14:38.51 
atbd hi, I found something missing in the man. Do you have a mailing list for contribution ?17:24.11 
sebras atbd: no, we don't really have a mailing list. if you want to send a patch to us, please register a bug (severity enhancement) over at https://bugs.ghostscript.com/17:37.35 
  sometimes people try to contact us using various other ghostscript mailing lists, but they get redirected here or to the website above.17:38.42 
atbd Okay thanks, I will file a bug17:39.36 
sebras atbd: thank you!17:40.03 
 <<<Back 1 day (to 2020/01/19)Forward 1 day (to 2020/01/21)>>> 
ghostscript.com #ghostscript
Search: