GithubHelp home page GithubHelp logo

Comments (1)

Spakman avatar Spakman commented on July 17, 2024

This patch works around the problem by ensuring that insert_more_chars is never called. It forces even terminals with the "IC" capability to use another method to insert characters.

A better solution may be to implement something to call tgoto(). Perhaps using the DL library? I don't know how that affects performance. Any opinions gratefully received.

I don't think that this patch should make it into 0.4.1 so I'll stick the 0.5.0 milestone on it. It works fine for me, but hasn't had nearly enough testing, IMO.

From b2a72308ad7ecdc583492c42006ac1996a7f2c95 Mon Sep 17 00:00:00 2001
From: Mark Somerville <[email protected]>
Date: Fri, 17 Jun 2011 19:23:54 +0100
Subject: [PATCH] Always set @_rl_terminal_can_insert to false

Currently, rb-readline doesn't call the C function tgoto(). Until we can 
do that, setting @_rl_terminal_can_insert to false ensures that
insert_some_chars() doesn't get called.

This works around a problem with long(ish) prompts with invisible
characters that sometimes occured when exiting from an i-search. The 
problem was evident on gnome-terminal (which has the "IC" capability).

Tested-by: Mark Somerville <[email protected]> [MRI 1.8.7/1.9.2, RBX 1.2.3]
Signed-off-by: Mark Somerville <[email protected]>
---
 lib/rbreadline.rb |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/lib/rbreadline.rb b/lib/rbreadline.rb
index 409d0c6..1b0dea1 100644
--- a/lib/rbreadline.rb
+++ b/lib/rbreadline.rb
@@ -807,7 +807,12 @@ module RbReadline
    @_rl_term_goto = nil^M
    @_rl_term_pc = nil^M
 ^M
-   # Non-zero if we determine that the terminal can do character insertion.^M
+   # "An application program can assume that the terminal can do character^M
+   # insertion if *any one of* the capabilities `IC', `im', `ic' or `ip' is^M
+   # provided.". But we can't do anything if only `ip' is provided, so...^M
+   #^M
+   # Currently rb-readline can't tgoto(). Setting this to false means that^M
+   # insert_some_chars doesn't get called and some other method is used.^M
    @_rl_terminal_can_insert = false^M
 ^M
    # How to insert characters.^M
@@ -2028,12 +2033,6 @@ module RbReadline
          _rl_get_screen_size(tty, 0)^M
       end^M
 ^M
-      # "An application program can assume that the terminal can do^M
-      #    character insertion if *any one of* the capabilities `IC',^M
-      #    `im', `ic' or `ip' is provided."  But we can't do anything if^M
-      #    only `ip' is provided, so...^M
-      @_rl_terminal_can_insert = !!(@_rl_term_IC || @_rl_term_im || @_rl_term_ic)^M
-^M
       # Check to see if this terminal has a meta key and clear the capability^M
       #   variables if there is none.^M
       @term_has_meta = !!(tgetflag("km") || tgetflag("MT"))^M
-- 
1.7.4.4

from rb-readline.

Related Issues (20)

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.