bug#81661: 32.0.50; Offscreen context in show-paren-mode truncates multi-character keyword paren
Troy Brown via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <[email protected]>
| Newsgroups | gmane.emacs.bugs |
|---|---|
| Message-ID | <CABvCZ40iO5bWr4J--OV_bf7XadQu9wbrTEW+oo2in-nkb7p+5w@mail.gmail.com> |
Some languages, such as Ruby, highlight keywords when
`show-paren-mode` is enabled. The following demonstrates an example
with a "do loop". Open the following in `ruby-mode`.
```ruby
5.times do |i|
print "Number: #{i}"
end
```
Either resize the window so the first line is not showing or insert
more empty lines to force it off the screen. Execute "M-: (setq
show-paren-context-when-offscreen t) RET" to enable offscreen context
display. Move point to the end of the "end" keyword. The echo area
will show "Matches 5.times d". The "do" keyword is truncated to the
first character rather than showing the entire keyword. This same
problem manifests using other forms of offscreen context display as
well, such as the "overlay" or "child-frame" settings.
The underlying issue appears to be the use of the
`blink-paren-open-paren-line-string` function to construct the line of
context which will be displayed in the echo area (or elsewhere). That
function only takes a single parameter consisting of the position in
the buffer where the "paren" begins. The function assumes the keyword
"paren" is only a single character rather than possibly being multiple
characters long. The function attempts to truncate the context line
such that the "paren" is the last part of the context, but assumes
it's only a single character in length resulting in the keyword being
truncated.