Bug report #7340

GRASS Shell cursor misbehaving

Added by Thomas W almost 7 years ago. Updated over 6 years ago.

Assignee:Radim Blazek
Affected QGIS version:master Regression?:No
Operating System:linux, OSX Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:16322


In the GRASS Shell the cursor misbehaves badly. Typing a single character causes it to be half-obscured by the solid black cursor. With longer commands, the cursor continues to "lag" the typing, with the last two or more characters typed being invisible. Moving the cursor with the arrow keys results in the character the cursor is on showing correctly, but preceding characters being outright hidden.

I would say the behaviour renders the GRASS Shell in QGIS more or less unusable.

I am running Kubuntu 12.10, with QGIS installed from the ubuntugis PPA.

QGIS About page:

QGIS version
QGIS code revision
Compiled against Qt
Running against Qt
Compiled against GDAL/OGR
Running against GDAL/OGR
GEOS Version
PostgreSQL Client Version
SpatiaLite Version
QWT Version

grass_cli.mp4 (519 KB) Giovanni Manghi, 2013-06-04 04:47 PM

Associated revisions

Revision 8a4499b2
Added by Radim Blazek over 6 years ago

GRASS - set correctly qtermwidget font, fixes #7340

Revision 4c5c159a
Added by Radim Blazek over 6 years ago

Force GRASS shell font by setStyleSheet, hopefully fixes #7340; added black on white scheme


#1 Updated by Giovanni Manghi almost 7 years ago

  • Category set to GRASS
  • Target version set to Version 2.0.0
  • Affected QGIS version changed from 1.8.0 to master

I have also seen this issue, it affects also master.

#2 Updated by Giovanni Manghi almost 7 years ago

  • Priority changed from Normal to Severe/Regression
  • Operating System set to linux

#3 Updated by John Tull almost 7 years ago

  • Operating System changed from linux to linux, OSX

A note to say this problem is reproducible on my OSX platform with trunk as of 01 May 2013.

#4 Updated by Radim Blazek over 6 years ago

  • Assignee set to Radim Blazek

#5 Updated by Radim Blazek over 6 years ago

I cannot reproduce it on Debian with Qt 4.6.3.

The GRASS shell is using copy of http://qtermwidget.sourceforge.net project which is abandoned. QTermWidget was based on Konsole: https://projects.kde.org/projects/kde/applications/konsole. The right solution would probably be to update GRASS shell to use Konsole project but that is most probably a lot of work and it could introduce more problems than this issue.

Try to find if it is only refresh problem, i.e. if some characters are not displayed correctly try to resize the window, minimize and restore etc.

#6 Updated by Radim Blazek over 6 years ago

The problem seems to be described here https://bugs.kde.org/show_bug.cgi?id=215937. It seems to be due to wrong font metrics or something like that. I am able to reproduce it changing

font.setPointSize( 10 );


font.setPointSize( 20 );

in src/plugins/grass/qtermwidget/qtermwidget.cpp. The font size in shell is not changed but cursor is shifted. The shift is fixed and does not depend on the length of the string typed.

#7 Updated by Radim Blazek over 6 years ago

  • Status changed from Open to Closed

#8 Updated by Giovanni Manghi over 6 years ago

  • File grass_cli.mp4 added
  • Status changed from Closed to Feedback
  • Priority changed from Severe/Regression to High

does not work here on Linux Mint on the latest master. See attached screenshot.

#9 Updated by Radim Blazek over 6 years ago

Some observations:
  • QTermWidget tries to set via TerminalDisplay::setVTFont font with family "Monospace"
  • setVTFont() calls QWidget::setFont() but it fails, the font is forced from somewhere else
  • if default font used for the widget is not monospace, width calculations do not work (even it seems that non monospace should also be supported, see _fixedFont flag) and result is cursor shift
  • the problem seems to appear especially on GNOME
  • default GNOME 3 font-name is "Cantarell 11" and that is applied also to GRASS shell
  • if I change the font in gconf: org > gnome > desktop > interface > font-name to "Courier", the shift disappeares

I'll try to find why it is not possible to set the font on the widget.

#10 Updated by Giovanni Manghi over 6 years ago

  • Priority changed from High to Normal

#11 Updated by Radim Blazek over 6 years ago

  • Status changed from Feedback to Closed

#12 Updated by Radim Blazek over 6 years ago

QWidget::setFont() does not guarantee to really change the font, I added

setStyleSheet( "font-size: 10pt; font-family: Monospace;" )

on the TerminalDisplay but it has some side effects like setting background to black so that some more changes were necessary.

I have tested on Gnome where cursor was shifted before and it works.

I have also set black on white scheme.

Also available in: Atom PDF