https://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112016-12-19T00:06:42ZRuby Issue Tracking SystemRuby master - Feature #13050: Readline: expose rl_completion_quote_character variablehttps://bugs.ruby-lang.org/issues/13050?journal_id=620932016-12-19T00:06:42Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Feedback</i></li></ul><p>That variable seems an <code>int</code>.<br>
Is it just a single byte, or a code point?</p> Ruby master - Feature #13050: Readline: expose rl_completion_quote_character variablehttps://bugs.ruby-lang.org/issues/13050?journal_id=620972016-12-19T10:22:27Zgeorgebrock (George Brocklehurst)
<ul></ul><p>Nobuyoshi Nakada wrote:</p>
<blockquote>
<p>That variable seems an <code>int</code>.<br>
Is it just a single byte, or a code point?</p>
</blockquote>
<p>I had assumed that it was a single byte, but after reading the Readline source code more carefully it looks like it can also be code point. I'll submit an updated patch that supports multi-byte quote characters.</p> Ruby master - Feature #13050: Readline: expose rl_completion_quote_character variablehttps://bugs.ruby-lang.org/issues/13050?journal_id=620982016-12-19T11:02:19Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul></ul><p>Then you can use <code>rb_enc_uint_chr()</code>, probably.</p> Ruby master - Feature #13050: Readline: expose rl_completion_quote_character variablehttps://bugs.ruby-lang.org/issues/13050?journal_id=621162016-12-20T10:25:59Zgeorgebrock (George Brocklehurst)
<ul></ul><p>It looks like my original implementation is correct: Readline doesn't support multibyte quote characters.</p>
<p>The source code I'm looking at is here: <a href="http://git.savannah.gnu.org/cgit/readline.git/tree/complete.c" class="external">http://git.savannah.gnu.org/cgit/readline.git/tree/complete.c</a></p>
<p>The <code>_rl_find_completion_word</code> function (line 1083) returns the quote character that is eventually assigned to <code>rl_completion_quote_character</code>.</p>
<p><code>_rl_find_completion_word</code> does scan through the string character by character instead of byte by byte (<code>MB_NEXTCHAR</code> on line 1105), which is why I thought multibyte should be supported when I looked at the source code yesterday. However, in spite of going character by character through the input, the actual quote character handling is all byte-oriented. First, it uses <code>strchr</code> to detect if the first byte of the current character is in <code>rl_completer_quote_characters</code> (line 1134), which could lead to all kinds of strange results if used with multibyte characters. Second, it only takes a single byte as the return value (assigned on line 1137, and returned on line 1212).</p>
<p>I have a look at the libedit source code too, but only far enough to confirm that it doesn't support <code>rl_completion_quote_character</code>.</p>
<p>It's possible we should raise if any multibyte characters are passed to <code>Readline::completer_quote_characters=</code>, but I think that's out-of-scope for this patch.</p> Ruby master - Feature #13050: Readline: expose rl_completion_quote_character variablehttps://bugs.ruby-lang.org/issues/13050?journal_id=627102017-01-29T01:01:20Zgeorgebrock (George Brocklehurst)
<ul></ul><p>I should have mentioned in my previous comment: I also tested Readline with multi-byte quote characters, and got back only the value of the first byte from <code>rl_completion_quote_character</code>.</p>
<p>Anything else I can do to move this forward?</p> Ruby master - Feature #13050: Readline: expose rl_completion_quote_character variablehttps://bugs.ruby-lang.org/issues/13050?journal_id=653062017-06-07T15:57:56Zgeorgebrock (George Brocklehurst)
<ul></ul><p>Are there any problems with applying this patch? I'm happy to make changes if something is blocking it.</p>
<p>Unicode support isn't going to be possible without upstream changes in Readline.</p> Ruby master - Feature #13050: Readline: expose rl_completion_quote_character variablehttps://bugs.ruby-lang.org/issues/13050?journal_id=682012017-12-05T18:23:37Zgeorgebrock (George Brocklehurst)
<ul></ul><p>This has been open for a year. Is there anything I can do towards getting the patch accepted?</p> Ruby master - Feature #13050: Readline: expose rl_completion_quote_character variablehttps://bugs.ruby-lang.org/issues/13050?journal_id=727132018-06-29T13:51:47Zgeorgebrock (George Brocklehurst)
<ul></ul><p>I'd still love to get this merged. Is there anything I can do to help get the patch accepted?</p> Ruby master - Feature #13050: Readline: expose rl_completion_quote_character variablehttps://bugs.ruby-lang.org/issues/13050?journal_id=732292018-07-30T16:21:39Zshevegen (Robert A. Heiler)shevegen@gmail.com
<ul></ul><p>It is now registered for the next upcoming developer meeting at:</p>
<p><a href="https://bugs.ruby-lang.org/issues/14921" class="external">https://bugs.ruby-lang.org/issues/14921</a></p>
<p>(I think nobu added it to the developer meeting recently; it was most likely<br>
forgotten for some time).</p>
<p>Hopefully future patches may be simpler for you - I think the most likely<br>
explanation is that it was forgotten. The developer meeting format changed<br>
a few months ago, so you can add issues directly on the ruby developer<br>
tracker. (And if it is not answered yet, it may end up being at "carry<br>
over" from prior meetings.)</p>
<p>To the topic at hand - I use readline a lot so every readline-related support<br>
helps. Whenever I need commandline input in ruby programs, I usually turn<br>
to readline first; and as generic fallback, use $stdin.gets.chomp in a loop<br>
normally. It's good to see other people are also using readline, it is one<br>
of those programs I really need all the time when it comes to user input.</p> Ruby master - Feature #13050: Readline: expose rl_completion_quote_character variablehttps://bugs.ruby-lang.org/issues/13050?journal_id=738542018-09-02T23:27:45Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul><li><strong>Status</strong> changed from <i>Feedback</i> to <i>Closed</i></li></ul><p>Applied in changeset trunk|r64618.</p>
<hr>
<p>Readline: expose rl_completion_quote_character variable</p>
<p>[Feature <a class="issue tracker-2 status-5 priority-4 priority-default closed" title="Feature: Readline: expose rl_completion_quote_character variable (Closed)" href="https://bugs.ruby-lang.org/issues/13050">#13050</a>]</p>
<p>From: georgebrock (George Brocklehurst) <a href="mailto:ruby@georgebrock.com" class="email">ruby@georgebrock.com</a></p>