From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on starla X-Spam-Level: X-Spam-Status: No, score=-1.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 Received: from nue.mailmanlists.eu (nue.mailmanlists.eu [IPv6:2a01:4f8:1c0c:6b10::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 201E81F44D for ; Wed, 3 Apr 2024 03:45:09 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=pass (1024-bit key; secure) header.d=ml.ruby-lang.org header.i=@ml.ruby-lang.org header.a=rsa-sha256 header.s=mail header.b=Xa1mhDf0; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ruby-lang.org header.i=@ruby-lang.org header.a=rsa-sha256 header.s=s1 header.b=Dlu19xpR; dkim-atps=neutral Received: from nue.mailmanlists.eu (localhost [127.0.0.1]) by nue.mailmanlists.eu (Postfix) with ESMTP id A40FC83B77; Wed, 3 Apr 2024 03:44:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ml.ruby-lang.org; s=mail; t=1712115899; bh=bNkSDq6KS+vCZ3bz1/MrRGW9V6cEs2aM3lMR8XxEtvQ=; h=Date:References:To:Reply-To:Subject:List-Id:List-Archive: List-Help:List-Owner:List-Post:List-Subscribe:List-Unsubscribe: From:Cc:From; b=Xa1mhDf0P4LLxuIy2BJRmBgDESM37TLoAWjmWMQyHhs+BRPOLdoMuUXPipVWJ9wNO PZCNl8ZuEsl5LRwKXcWrM/tgU+uSbX9xy1VzTB1YT6+ni3RdPhE5ita+g7OqQGVFV+ oJglCApNP0Hr4gW02hGGbq6+8whnnlHJnyJT2rUA= Received: from s.wfbtzhsw.outbound-mail.sendgrid.net (s.wfbtzhsw.outbound-mail.sendgrid.net [159.183.224.105]) by nue.mailmanlists.eu (Postfix) with ESMTPS id CE53D83B0D for ; Wed, 3 Apr 2024 03:44:56 +0000 (UTC) Authentication-Results: nue.mailmanlists.eu; dkim=pass (2048-bit key; unprotected) header.d=ruby-lang.org header.i=@ruby-lang.org header.a=rsa-sha256 header.s=s1 header.b=Dlu19xpR; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ruby-lang.org; h=from:references:subject:mime-version:content-type: content-transfer-encoding:list-id:to:cc:content-type:from:subject:to; s=s1; bh=dvviVSl6tAl3u8kaq6Qrk0NWZ/32kaZ664mrWCeOak4=; b=Dlu19xpRfDSmmej4byiMiYC4eldOgBq+EIJ4mPVLFyuz6bhkNFIoa75lyBMHHbY8aiJZ LskYh+c24TvTtGjoNH2wLmomxZazmx9W+sLsc8ByfcMMeC5u2YHQ2QiEsfLP9ul/1uFYkx OCWgJ2POzHDvE1stgxLn6hsPkMfmPt3wGgh89GvOwk4Zpqr7dLExLk3S8DEK1gMb9fuo2c OcHK3FRPV6OaVnQTdlSXP9ojfpuYyqPJRPhPksHbkYEAMGsZh1UlIbx17Mi5N0xtruDFOX aMH0IHxJdzDY8iZocsiX0r5EBJ2KLe5ly3OQFw5VEL16kcOZnjf0mLewbUNKoSGQ== Received: by recvd-75c664ffc8-68csg with SMTP id recvd-75c664ffc8-68csg-1-660CD0B7-19 2024-04-03 03:44:55.954150388 +0000 UTC m=+1320310.788224028 Received: from herokuapp.com (unknown) by geopod-ismtpd-35 (SG) with ESMTP id ZWyqN_y1SBedwO3b2vT16w for ; Wed, 03 Apr 2024 03:44:55.917 +0000 (UTC) Date: Wed, 03 Apr 2024 03:44:55 +0000 (UTC) Message-ID: References: Mime-Version: 1.0 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Feature X-Redmine-Issue-Id: 13604 X-Redmine-Issue-Author: graywolf X-Redmine-Issue-Assignee: aycabta X-Redmine-Issue-Priority: Normal X-Redmine-Sender: hsbt X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-Redmine-MailingListIntegration-Message-Ids: 94008 X-SG-EID: =?us-ascii?Q?u001=2ESNtsfy=2FRYrUmxOeGSN+Ah1new64UppKFg8YOAgra6KK6sIhqEP6LswYh4?= =?us-ascii?Q?tCf2AhAD20FCmXanLCSpdJ9Heq83FKB1eeA=2FIRz?= =?us-ascii?Q?=2FUFVHcMb3GMX8bL2eWuJqwBOAA9yWaCGOfEsL29?= =?us-ascii?Q?7nWZRuoGDF+IqMihyMtSrsnTsLAKrwkPb2OZ=2Fsv?= =?us-ascii?Q?Bo10F6CnKu36tZdTNX1m29tGMN2fGB5rKSD7R=2Fu?= =?us-ascii?Q?JuDxge7WQyytoEa8cVRCxqliTKzU43+MsK5NIZd?= =?us-ascii?Q?PPFUHJ66O=2FGnUlxYFjjkovau0A=3D=3D?= To: ruby-core@ml.ruby-lang.org X-Entity-ID: u001.I8uzylDtAfgbeCOeLBYDww== Message-ID-Hash: QTIFMB7NMPIN2PUPAAY6NTPSGS6W5RZY X-Message-ID-Hash: QTIFMB7NMPIN2PUPAAY6NTPSGS6W5RZY X-MailFrom: bounces+313651-b711-ruby-core=ml.ruby-lang.org@em5188.ruby-lang.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.3 Precedence: list Reply-To: Ruby developers Subject: [ruby-core:117413] [Ruby master Feature#13604] Exposing alternative interface of readline List-Id: Ruby developers Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: "hsbt (Hiroshi SHIBATA) via ruby-core" Cc: "hsbt (Hiroshi SHIBATA)" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Issue #13604 has been updated by hsbt (Hiroshi SHIBATA). Status changed from Assigned to Closed The C wrapper library of libreadline is extracted https://github.com/ruby/readline-ext from Ruby 3.3. If you still interest this, can you submit your proposal to upstream? ---------------------------------------- Feature #13604: Exposing alternative interface of readline https://bugs.ruby-lang.org/issues/13604#change-107592 * Author: graywolf (Gray Wolf) * Status: Closed * Assignee: aycabta (aycabta .) ---------------------------------------- GNU Readline has multiple modes of operation. At the moment, the readline extension only supports typical, `Readline.readline` mode. However, there is also alternative callback-based interface which is also useful. ```ruby require_relative 'readline' PROMPT = "rltest$ " $running = true $sigwinch_received = false Readline.handler_install(PROMPT, add_hist: true) do |line| # Can use ^D (stty eof) or `exit' to exit. if !line || line == "exit" puts unless line puts "exit" Readline.handler_remove $running = false else puts "input line: #{line}" end end Signal.trap('SIGWINCH') { $sigwinch_received = true } while $running do rs = IO.select([$stdin]) if $sigwinch_received Readline.resize_terminal $sigwinch_received = false end Readline.read_char if r = rs[0] end puts "rltest: Event loop has exited" ``` Patch adding support for this is attached. This is my first try at contributing to ruby, so please tell me what I did wrong (I'm sure something, C is not my strong language). ---Files-------------------------------- readline_alternative_interface.diff (7.22 KB) readline_alternative_interface_example.rb (606 Bytes) readline_alternative_interface_update1.diff (7.08 KB) -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/