Jean-Marc Lasgouttes wrote: > Angus> b m wrote: >>> I have been a LyX user for many many years now and I would like to >>> thank the developers for your dedication. >>> >>> LyX used to have a block cursor, but in the Qt version now there is >>> only a blinking line cursor. It is extremely hard to see the cursor >>> on a page that is dense with equations. It would greatly enhance >>> usability to add a block cursor. > > Angus> I have to say that I too like emacs notion of a cursor. Looking > Angus> at the code, it appears that all we are missing is a proper > Angus> notion of 'width'. Ie, how wide the character embedded by the > Angus> cursor actually is. > > And then, wold the actual drawing of the cursor be easy?
It would need to redraw the current character with a LColor::cursor_background background color, that's all. This is the block of code that would be modified, which shows clearly the existing width kludge. Angus void QScreen::showCursor(int x, int y, int h, Cursor_Shape shape) { cursor_x_ = x; cursor_y_ = y; cursor_h_ = h; switch (shape) { case BAR_SHAPE: cursor_w_ = 1; break; case L_SHAPE: cursor_w_ = cursor_h_ / 3; break; case REVERSED_L_SHAPE: cursor_w_ = cursor_h_ / 3; cursor_x_ = x - cursor_w_ + 1; break; } if (!nocursor_pixmap_.get() || cursor_w_ != nocursor_pixmap_->width() || cursor_h_ != nocursor_pixmap_->height()) { nocursor_pixmap_.reset(new QPixmap(cursor_w_, cursor_h_)); } if (!qApp->focusWidget()) return; // save old area bitBlt(nocursor_pixmap_.get(), 0, 0, owner_.getPixmap(), cursor_x_, cursor_y_, cursor_w_, cursor_h_); Painter & pain(owner_.getPainter()); pain.start(); pain.line(x, y, x, y + h - 1, LColor::cursor); switch (shape) { case BAR_SHAPE: break; case REVERSED_L_SHAPE: case L_SHAPE: pain.line(cursor_x_, y + h - 1, cursor_x_ + cursor_w_ - 1, y + h - 1, LColor::cursor); break; } pain.end(); owner_.getContent()->repaint( cursor_x_, cursor_y_, cursor_w_, cursor_h_); }