Code Monkey home page Code Monkey logo

Comments (24)

blueyed avatar blueyed commented on June 24, 2024

@zartstrom
Do you have a reproducible, simple test case, please? ;D

Please paste the git diff from the src we've been fiddling with for reference.

Also, what is the airline setting / symbol name?!

Note: only happened when the terminal was wide enough (half your screen).

from pkgbuild-rxvt-unicode-wide.

zartstrom avatar zartstrom commented on June 24, 2024

I cloned the repo again, commented out the three other patches and did a
diff -Naur ./src/rxvt-unicode-9.22/src/rxvtfont.C ../PKGBUILD-rxvt-unicode-wide/src/rxvt-unicode-9.22/src/rxvtfont.C > patch.txt
The diff is shown below. We deleted so many lines? :o
../PKGBUILD-rxvt-unicode-wide is the version we fiddled with.

I try to come up with the evil character and a more isolated scenario to reproduce the crash.

--- ./src/rxvt-unicode-9.22/src/rxvtfont.C  2016-09-19 20:27:35.289822043 +0200
+++ ../PKGBUILD-rxvt-unicode-wide/src/rxvt-unicode-9.22/src/rxvtfont.C  2016-09-18 20:34:48.336894812 +0200
@@ -1030,10 +1030,10 @@

   careful = xcs->lbearing < 0 || xcs->rbearing > prop->width * wcw;

-#if !ENABLE_WIDE_GLYPHS
+//#if !ENABLE_WIDE_GLYPHS
   if (careful && !OVERLAP_OK (w, wcw, prop))
     return false;
-#endif
+//#endif

   return true;
 }
@@ -1245,22 +1245,11 @@

       FT_Face face = XftLockFace (f);

-/*
- * use ascent, descent and height from XftFont *f instead of FT_Face face.
- * this somehow reproduces the behaviour of the line height as seen on xterm.
-
       ascent  = (face->size->metrics.ascender + 63) >> 6;
       descent = (-face->size->metrics.descender + 63) >> 6;
       height  = max (ascent + descent, (face->size->metrics.height + 63) >> 6);
       width   = 0;

- */
-
-      ascent  = f->ascent;
-      descent = f->descent;
-      height  = max (ascent + descent, f->height);
-      width   = 0;
-
       bool scalable = face->face_flags & FT_FACE_FLAG_SCALABLE;

       XftUnlockFace (f);
@@ -1284,21 +1273,12 @@
           XGlyphInfo g;
           XftTextExtents16 (disp, f, &ch, 1, &g);

-/*  
- * bukind: don't use g.width as a width of a character!
- * instead use g.xOff, see e.g.: http://keithp.com/~keithp/render/Xft.tutorial
-
           g.width -= g.x;

           int wcw = WCWIDTH (ch);
           if (wcw > 0) g.width = (g.width + wcw - 1) / wcw;

           if (width    < g.width       ) width    = g.width;
- */
-          int wcw = WCWIDTH (ch);
-          if (wcw > 1) g.xOff = g.xOff / wcw;
-          if (width < g.xOff) width = g.xOff;
-
           if (height   < g.height      ) height   = g.height;
           if (glheight < g.height - g.y) glheight = g.height - g.y;
         }
@@ -1361,6 +1341,7 @@
   if (!prop || prop->width == rxvt_fontprop::unset)
     return true;

+
   // check character against base font bounding box
   FcChar32 ch = unicode;
   XGlyphInfo g;
@@ -1370,15 +1351,16 @@
   int wcw = max (WCWIDTH (unicode), 1);

   careful = g.x > 0 || w > prop->width * wcw;
+  printf("Careful: %d\n", careful);

 #if !ENABLE_WIDE_GLYPHS
   if (careful && !OVERLAP_OK (w, wcw, prop))
     return false;
+#endif

   // this weeds out _totally_ broken fonts, or glyphs
   if (!OVERLAP_OK (g.xOff, wcw, prop))
     return false;
-#endif

   return true;
 }
@@ -1496,6 +1478,7 @@
 #endif
             XftDrawRect (d2, &term->pix_colors[bg >= 0 ? bg : Color_bg].c, 0, 0, w, h);

+          printf("1:%d %d %d %d %d\n", d2, &term->pix_colors[fg].c, f, enc, ep - enc);
           XftDrawGlyphSpec (d2, &term->pix_colors[fg].c, f, enc, ep - enc);
           XCopyArea (disp, d2, d, gc, 0, 0, w, h, x, y);
         }
@@ -1504,6 +1487,7 @@
     }
   else
     {
+      printf("2:%d %d %d %d %d\n", d, &term->pix_colors[fg].c, f, enc, ep - enc);
       clear_rect (d, x, y, w, h, bg);
       XftDrawGlyphSpec (d, &term->pix_colors[fg].c, f, enc, ep - enc);
     }

from pkgbuild-rxvt-unicode-wide.

blueyed avatar blueyed commented on June 24, 2024

We deleted so many lines? :o

They come from the other patches (line-spacing-fix.patch at least); so you have patched the new clone already, but removed those patches.

Can you please try it from the branch that is used for the patch: https://github.com/blueyed/rxvt-unicode/tree/display-wide-glyphs:

git clone -b display-wide-glyphs https://github.com/blueyed/rxvt-unicode
cd rxvt-unicode
wget http://dist.schmorp.de/rxvt-unicode/rxvt-unicode-9.22.tar.bz2
tar xf rxvt-unicode-9.22.tar.bz2
cp -a rxvt-unicode-9.22/{libev,libptytty} .
./configure --enable-unicode3 --enable-256-color --enable-wide-glyphs --disable-smart-resize
make
src/rxvt

(no need to install it)

If you can reproduce it, you can bisect it:
git bisect bad
git checkout fdce9d7 # first commit of this patch
make
src/rxvt

Then either git bisect good (no crash) or git bisect bad (crash): git will move you to the next commit then. Just run make && src/rxvt then to test it.

Let's see if that helps.

Then, of course a simple test case (minimal vimrc to trigger this) would be nice.
Also the value of &columns from Vim seemed to be important (possibly to make the char in the lower right visible).

Thanks!

from pkgbuild-rxvt-unicode-wide.

blueyed avatar blueyed commented on June 24, 2024

FYI: maxlinenr is only used when the window is wider than 80 chars in airline: https://github.com/blueyed/vim-airline/blob/7a720bbbd74b22fc029844c9ff087bbc1e09effb/autoload/airline/init.vim#L133-L139.

from pkgbuild-rxvt-unicode-wide.

blueyed avatar blueyed commented on June 24, 2024

Check also if changing something in this area helps:

  let g:airline_section_z = airline#section#create(['windowswap', 'obsession', '%3p%%'.spc, 'linenr', 'maxlinenr', spc.':%3v'])
  • remove 'maxlinenr', from there
  • replace spc.' with ' (a regular space)

from pkgbuild-rxvt-unicode-wide.

blueyed avatar blueyed commented on June 24, 2024

Please also paste the output from xrdb -q|grep -i urxvt.

from pkgbuild-rxvt-unicode-wide.

zartstrom avatar zartstrom commented on June 24, 2024

I built rxvt by your instructions on my work laptop, and it reproduced the crash as well. (execute nvim in the rxvt window).
I replaced ☰ (= U2630) by another character as value for g:airline_symbols.maxlinenr, and nvim didn't crash. ⇒ U2630 (together with the rest of my settings) causes the crash.

The output of xrdb -q|grep -i urxvt is

URxvt*depth:    24
URxvt*buffered: false
URxvt*background:   [95]#000000
URxvt*foreground:   #FFFFFF
URxvt.font: xft:Hack:size=10:antialias=true:hinting=true,xft:Symbola,xft:UbuntuMonoDerivativePowerline Nerd Font
URxvt.boldFont: xft:Hack:style=Bold:size=10:antialias=true:hinting=true,xft:DejaVu Sans Mono:size=12,xft:FontAwesome:size=12
URxvt.italicFont:   xft:Hack:style=Italic:size=10:antialias=true:hinting=true,xft:DejaVu Sans Mono:size=12,xft:FontAwesome:size=12
URxvt.boldItalicFont:   xft:Hack:style=Bold Italic:size=10:antialias=true:hinting=true,xft:DejaVu Sans Mono:size=12,xft:FontAwesome:size=12
URxvt*scrollstyle:  rxvt
URxvt*scrollBar:    false
URxvt*skipBuiltinGlyphs:    false
URxvt*perl-ext-common:  resize-font,fullscreen,vtwheel
URxvt.resize-font.smaller:  C-Down
URxvt.resize-font.bigger:   C-Up
URxvt.keysym.F11:   perl:fullscreen:switch
URxvt.keysym.Home:  \033[1~
URxvt.keysym.End:   \033[4~
URxvt.keysym.KP_Home:   \033[1~
URxvt.keysym.KP_End:    \033[4~
URxvt.letterSpace:  -1
URxvt*.transparent: true
URxvt*.shading: 60

from pkgbuild-rxvt-unicode-wide.

zartstrom avatar zartstrom commented on June 24, 2024

Started bisecting (btw what a cool command!). It seems your first commit is the culprit.
git co 15ced41 && make -B && src/rxvt is good (commit from Emanuele Giaquinta 8 weeks ago)
and next
git co fdce9d7 && make -B && src/rxvt is bad/crashes

from pkgbuild-rxvt-unicode-wide.

blueyed avatar blueyed commented on June 24, 2024

It seems your first commit is the culprit.

Not unlikely, especially given there are fixes to it later.. ;)
Can you then test all following commits to see if they are all causing the crash, please?

from pkgbuild-rxvt-unicode-wide.

blueyed avatar blueyed commented on June 24, 2024

Can you also create a screen dump of the output that would cause the crash, i.e. from a working urxvt instance, the paste it into a file and upload it as a gist and/or paste it here.
Hopefully that makes it easier to reproduce.
Make sure that cat screendump.txt also causes the crash in a bad urxvt instance then.

from pkgbuild-rxvt-unicode-wide.

zartstrom avatar zartstrom commented on June 24, 2024

to no avail, I tried all commits, but there's a segmentation fault every time.

I don't understand the screen dump thing, I need some guidance..

Until now I did not find any text that lets rxvt crash by cat'ing or echo'ing. I.e. cat'ing the help file airline.txt does not lead to a crash (but displays U2630 correctly)

from pkgbuild-rxvt-unicode-wide.

blueyed avatar blueyed commented on June 24, 2024

I don't understand the screen dump thing, I need some guidance..

Create the test case in a working instance (i.e. using the system urxvt), and then just mark the whole window using the mouse (Shift-click-drag etc), then paste it into a file: it won't have the colors etc, but all the test. Basically an ASCII screenshot.

from pkgbuild-rxvt-unicode-wide.

blueyed avatar blueyed commented on June 24, 2024

Also try commenting your urxvt options, e.g. buffered.

Mine

% xrdb -q|grep -i urxvt | grep -v keysym|sort
URxvt.cutchars: "\\`\"'&()*,;<>?@[]^{|│}«»‘’"
URxvt.fading:   0
URxvt.font: xft:UbuntuMonoDerivativePowerline Nerd Font:size=8,xft:DejaVu Sans Mono,xft:monospace,xft:Symbola
URxvt.geometry: 84x32
URxvt.iconFile: /usr/share/icons/gnome/32x32/apps/gnome-terminal.png
URxvt.jumpScroll:   true
URxvt*letterSpace:  -1
URxvt.matcher.button:   2
URxvt.matcher.pattern.0:    (?:https?:/ /|ftp:/ /|news:/ /|mailto:|file:/ /|\\bwww\\.) [\\w\\-\\@;\\/?:&=%\\$.+!*\\x27,~#]* ( \\([\\w\\-\\@;\\/?:&=%\\$.+!*\\x27,~#]*\\) | [\\w\\-\\@;\\/?:&=%\\$+*~])+
URxvt.matcher.pattern.1:    [a-f0-9]{7,10}\\.\\.[a-f0-9]{7,10}
URxvt.perl-ext-common:  default,-matcher,urxvt-perls/url-select,urxvt-perls/keyboard-select,urxvt-font-size/font-size,bell-command
URxvt.saveLines:    81920
URxvt.scrollBar_floating:   true
URxvt.scrollBar_right:  true
URxvt.scrollBar:    true
URxvt.scrollColor:  #839496
URxvt.scrollstyle:  rxvt
URxvt.scrollTtyKeypress:    true
URxvt.scrollTtyOutput:  false
URxvt.scrollWithBuffer: true
URxvt.searchable-scrollback:    C-M-r
URxvt.secondaryScreen:  1
URxvt.secondaryScroll:  0
URxvt.skipScroll:   true
URxvt.tabbed.saveLines: 1000
URxvt.tabbed.scrollBar: false
URxvt.tabbed.secondaryScroll:   true
URxvt.tabbed.tabbar-bg: 0
URxvt.tabbed.tabbar-fg: 3
URxvt.tabbed.tab-bg:    1
URxvt.tabbed.tab-fg:    0
URxvt.urgentOnBell: true
URxvt.url-launcher: open-in-running-browser
URxvt.urlLauncher:  open-in-running-browser
URxvt.url-select.button:    2
URxvt.url-select.launcher:  open-in-running-browser
URxvt.url-select.underline: false
URxvt.visualBell:   true

from pkgbuild-rxvt-unicode-wide.

blueyed avatar blueyed commented on June 24, 2024

I've pushed some (probably unrelated) thing to https://github.com/blueyed/rxvt-unicode/tree/display-wide-glyphs, please try it though.

Any progress with making me able to reproduce and debug it? :)

from pkgbuild-rxvt-unicode-wide.

zartstrom avatar zartstrom commented on June 24, 2024

i will check it!

from pkgbuild-rxvt-unicode-wide.

zartstrom avatar zartstrom commented on June 24, 2024

I found at least something.
I wrote a test.sh, that tries to print a bold ☰.

#!/bin/bash

bold=$(tput bold)
echo "test ${bold}23/46☰"

If I start urxvt (./rxvt) and run ./test.sh the terminal crashes.
BUT if I start urxvt and cat test.sh the content of the file is displayed correctly. And if I then do ./test.sh urxvt doesn't crash, but displays a bold 23/46☰

The output of xrdb -q|grep -i urxvt is

URxvt*depth:    24
URxvt*buffered: false
URxvt*background:   [95]#000000
URxvt*foreground:   #FFFFFF
URxvt.font: xft:Hack:size=10
URxvt*scrollstyle:  rxvt
URxvt*scrollBar:    false
URxvt*perl-ext-common:  resize-font,fullscreen,vtwheel
URxvt.resize-font.smaller:  C-Down
URxvt.resize-font.bigger:   C-Up
URxvt.keysym.F11:   perl:fullscreen:switch
URxvt.keysym.Home:  \033[1~
URxvt.keysym.End:   \033[4~
URxvt.keysym.KP_Home:   \033[1~
URxvt.keysym.KP_End:    \033[4~
URxvt.letterSpace:  -1
URxvt*.transparent: true
URxvt*.shading: 60

Especially there is only one font setting URxvt.font: xft:Hack:size=10, but nothing for bold or italics fonts.

Lets see if you can reproduce the crash!

from pkgbuild-rxvt-unicode-wide.

blueyed avatar blueyed commented on June 24, 2024

I've used (only) your Xresources and have the Hack font installed, but the symbol gets not displayed for me?! (I see the square box). No crashes though.
With only Hack you should also not see it, since it's coming from Symbola IIRC?!
You are also using extra/ttf-hack from Arch, and not a custom Hack font/download?!

from pkgbuild-rxvt-unicode-wide.

zartstrom avatar zartstrom commented on June 24, 2024

Ctrl+Shift says the ☰ comes from Arial Unicode MS. fc-list doesn't list any other Hack-font.

grml, I destroyed my testcase. I simplified the test.sh script (assuming knowing what the cause of the problem is) and the ./test.sh in my last comment doesn't crash urxvt. (but nvim still crashes)

I'll try further...

from pkgbuild-rxvt-unicode-wide.

blueyed avatar blueyed commented on June 24, 2024

How can it come from Arial, if you are using just a single font?
Are there other font related settings in your Xresources?
Having a minimal Xresources file would be nice, once you can reproduce it again.

from pkgbuild-rxvt-unicode-wide.

blueyed avatar blueyed commented on June 24, 2024

I think we're far across the point where enabling debugging symbols and using gdb properly would be easier btw.. ;)
crossing fingers

from pkgbuild-rxvt-unicode-wide.

blueyed avatar blueyed commented on June 24, 2024

FWIW: ☰ (U2630) comes from Symbola for me.

I am currently trying to fix another (minor) issue, and noticed that it bascally boils down to wcwidth, so I've investigated into a major hack to make urxvt report the wcwidth through looking at the font.
It seems to work good so far, so that might become might next hack to this problem that is not accepted upstream.. ;)

from pkgbuild-rxvt-unicode-wide.

blueyed avatar blueyed commented on June 24, 2024

When looking into this a few weeks ago, I've started an alternative approach.
Please try this instead: https://github.com/blueyed/PKGBUILD-rxvt-unicode-wcwidthcallback

from pkgbuild-rxvt-unicode-wide.

blueyed avatar blueyed commented on June 24, 2024

Canonical location for now: blueyed/rxvt-unicode#1.

from pkgbuild-rxvt-unicode-wide.

blueyed avatar blueyed commented on June 24, 2024

The new patch is in the AUR: https://aur.archlinux.org/packages/rxvt-unicode-wcwidthcallback.

It might be interesting to see the reason for the crash still, but I consider this patch obsolete after all, and close this issue therefore for now.

from pkgbuild-rxvt-unicode-wide.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.