circle-fe-term-0.240250000755001750001750 014554723220 13271 5ustar00leoleo000000000000circle-fe-term-0.240250/.editorconfig000444001750001750 5314554723220 16041 0ustar00leoleo000000000000root = true [*.{pm,pl,t}] indent_size = 3 circle-fe-term-0.240250/Build.PL000444001750001750 234614554723220 14727 0ustar00leoleo000000000000use v5; use strict; use warnings; use Module::Build; my $build = Module::Build->new( module_name => 'Circle::FE::Term', dist_name => 'circle-fe-term', requires => { 'perl' => '5.026', 'Object::Pad' => '0.800', 'Syntax::Keyword::Match' => 0, 'Convert::Color' => '0.06', 'Convert::Color::XTerm' => 0, 'IO::Async' => '0.14', 'Net::Async::Tangence::Client' => '0.15', 'String::Tagged' => 0, 'Tangence::ObjectProxy' => '0.20_001', 'Text::Balanced' => 0, 'Tickit' => '0.55', 'Tickit::App::Plugin::EscapePrefix' => 0, 'Tickit::Async' => '0.21', 'Tickit::Event' => '0.58', 'Tickit::Style' => '0.40', 'Tickit::Term' => '0.27', 'Tickit::Widget::Entry' => '0.20', 'Tickit::Widget::Entry::Plugin::Completion' => 0, 'Tickit::Widget::HBox' => '0.32', 'Tickit::Widget::Scroller' => '0.15', 'Tickit::Widget::Tabbed' => '0.028', 'Tickit::Widget::VBox' => '0.31', 'Tickit::Window' => '0.42', }, auto_configure_requires => 0, # Don't add M::B to configure_requires share_dir => { dist => "share", }, license => 'perl', create_license => 1, create_readme => 1, ); $build->create_build_script; circle-fe-term-0.240250/Changes000444001750001750 1226114554723220 14743 0ustar00leoleo000000000000Revision history for Circle-FE-Term 0.240250 2024-01-26 [CHANGES] * Display the hidden count label in the format of the highest hidden level window [BUGFIXES] * Use Object::Pad for defining the Tickit::Widget::Entry subclass (RT151034) 0.232470 2023-09-04 [CHANGES] * Updated for Tickit::Widget::Tabbed v0.028; bugfix `tab_position` parameter handling * Use `Syntax::Keyword::Match` instead of `feature 'switch'` * Compress the ribbon labels even further by hiding lower level tabs entirely if there isn't room for all the numbers * General small code style updates and fixes 0.222060 2022-07-26 [CHANGES] * Support -4 and -6 commandline flags to force IPv4/IPv6 connection * Migrated various internal code into Tickit plugins * Experimental hack at exporting client metrics using Metrics::Any + Prometheus [BUGFIXES] * Remember to `use` required modules as appropriate (RT124848) 0.173170 2017-11-14 18:06:13 [CHANGES] * Render multiline events properly * Support blockquote formatting * Send typing notifications * Other Matrix-related fixes [BUGFIXES] * Don't apply indent tag within topic change events (RT120786) 0.170850 2017/03/27 18:38:29 [CHANGES] * Pay attention to the "transient" class hint on static widgets * Updates for more matrix event types 0.170740 2017/03/16 16:05:00 [CHANGES] * Support conditional if/then/else formatting in theme templates * Added theme templates for (some) matrix events [BUGFIXES] * Workaround for Tickit's SvIV text render bug - RT120630 0.163540 2016/12/20 20:08:47 [CHANGES] * Updates for Tickit 0.58: + Use $win->bind_event + Use event info named field accessors * Add theme fields for WATCH-related IRC events 0.160390 2016/02/09 23:50:37 [CHANGES] * Use Tickit 0.55 to avoid some of the ugly gutwrenching into Tickit internals previously used to implement the ESC- keypress prefixing 0.153000 2015/10/28 21:19:59 [CHANGES] * Updated for later Tickit versions * Updated for Tangence 0.21 / Net::Async::Tangence 0.13 0.140961 2014/04/07 20:29:54 [BUGFIXES] * Provide an 'orientation' method for Tickit::Widget::Tabbed::Ribbon * Various other updates for recent Tickit changes (Tickit::Style) 0.140960 2014/04/07 16:37:22 [CHANGES] * Updated for Tickit 0.44: + Use key/mouse event structure instead of positional arguments 0.140500 2014/02/20 15:08:24 [CHANGES] * Lazy loading of Scroller content as user scrolls upwards, rather than eagerly at startup * Updated for Tickit 0.42 0.132840 2013/10/12 22:32:37 [CHANGES] * Quiet the experimental::smartmatch warnings * Updated to use Tickit::Widget 0.35's ->render_to_rb and not the now-deprecated ->render 0.132180 CHANGES: * Fix Entry widget's Tab complete logic for Tickit 0.37 0.131670 CHANGES: * Theme templates for new IRC events * Display a 'pending' counter display until BE confirms sent commands 0.131340 CHANGES: * Updated for Tickit 0.32: + Widget attributes from Tickit::Style + Fix for new Tickit::on_key handling logic * Allow an initials-only ribbon mode * Bugfix for tab-complete logic when possibilities include prefixes of each other 0.130560 CHANGES: * Bugfix for datestamp display when backfilling * Use new circle-be's irc.mode $moder argument * Updated for Tangence 0.18 0.130290 CHANGES: * Fetch window backfill in the background, from the bottom upwards. * Set terminal window title to window item name * Bugfix to tab-complete 0.123420 CHANGES: * Handle tab-completion hints from BE * Handle window raise requests 0.123380 CHANGES: * Handle slow Alt+letter or separately typed Escape letter combinations by some currently-hacky logic around the on_key handler and an on-screen indicator. * Display a scrolling indicator showing the number of lines scrolled and whether more content has been added since scrolling. 0.122910 CHANGES: * Handle mouse input on activity ribbon * Futher bugfixes to ribbon label compression logic * Configurable label format - name_and_number, or just number 0.122820 CHANGES: * Switched to date-based version numbering scheme http://rjbs.manxome.org/rubric/entry/1749 * Connect NaTangence before starting Tickit, in case ssh wants to interact * Declare dependency on other Tickit::Widget:: classes * Attempt to dynamically compress activity ribbon labels, so it fits on smaller screens * Removed erroneous 'use Error' line that ought not have been released * Added --help 0.01 First version, released on an unsuspecting world. circle-fe-term-0.240250/LICENSE000444001750001750 4653414554723220 14467 0ustar00leoleo000000000000This software is copyright (c) 2024 by Paul Evans . This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Terms of the Perl programming language system itself a) the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or b) the "Artistic License" --- The GNU General Public License, Version 1, February 1989 --- This software is Copyright (c) 2024 by Paul Evans . This is free software, licensed under: The GNU General Public License, Version 1, February 1989 GNU GENERAL PUBLIC LICENSE Version 1, February 1989 Copyright (C) 1989 Free Software Foundation, Inc. 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The license agreements of most software companies try to keep users at the mercy of those companies. By contrast, our General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. The General Public License applies to the Free Software Foundation's software and to any other program whose authors commit to using it. You can use it for your programs, too. When we speak of free software, we are referring to freedom, not price. Specifically, the General Public License is designed to make sure that you have the freedom to give away or sell copies of free software, that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of a such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must tell them their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any work containing the Program or a portion of it, either verbatim or with modifications. Each licensee is addressed as "you". 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this General Public License and to the absence of any warranty; and give any other recipients of the Program a copy of this General Public License along with the Program. You may charge a fee for the physical act of transferring a copy. 2. You may modify your copy or copies of the Program or any portion of it, and copy and distribute such modifications under the terms of Paragraph 1 above, provided that you also do the following: a) cause the modified files to carry prominent notices stating that you changed the files and the date of any change; and b) cause the whole of any work that you distribute or publish, that in whole or in part contains the Program or any part thereof, either with or without modifications, to be licensed at no charge to all third parties under the terms of this General Public License (except that you may choose to grant warranty protection to some or all third parties, at your option). c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the simplest and most usual way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this General Public License. d) You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. Mere aggregation of another independent work with the Program (or its derivative) on a volume of a storage or distribution medium does not bring the other work under the scope of these terms. 3. You may copy and distribute the Program (or a portion or derivative of it, under Paragraph 2) in object code or executable form under the terms of Paragraphs 1 and 2 above provided that you also do one of the following: a) accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Paragraphs 1 and 2 above; or, b) accompany it with a written offer, valid for at least three years, to give any third party free (except for a nominal charge for the cost of distribution) a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Paragraphs 1 and 2 above; or, c) accompany it with the information you received as to where the corresponding source code may be obtained. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form alone.) Source code for a work means the preferred form of the work for making modifications to it. For an executable file, complete source code means all the source code for all modules it contains; but, as a special exception, it need not include source code for modules which are standard libraries that accompany the operating system on which the executable file runs, or for standard header files or definitions files that accompany that operating system. 4. You may not copy, modify, sublicense, distribute or transfer the Program except as expressly provided under this General Public License. Any attempt otherwise to copy, modify, sublicense, distribute or transfer the Program is void, and will automatically terminate your rights to use the Program under this License. However, parties who have received copies, or rights to use copies, from you under this General Public License will not have their licenses terminated so long as such parties remain in full compliance. 5. By copying, distributing or modifying the Program (or any work based on the Program) you indicate your acceptance of this license to do so, and all its terms and conditions. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. 7. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of the license which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the license, you may choose any version ever published by the Free Software Foundation. 8. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to humanity, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19xx name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (a program to direct compilers to make passes at assemblers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice That's all there is to it! --- The Perl Artistic License 1.0 --- This software is Copyright (c) 2024 by Paul Evans . This is free software, licensed under: The Perl Artistic License 1.0 The "Artistic License" Preamble The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications. Definitions: "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification. "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder as specified below. "Copyright Holder" is whoever is named in the copyright or copyrights for the package. "You" is you, if you're thinking about copying or distributing this Package. "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.) "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it. 1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers. 2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version. 3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following: a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as uunet.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package. b) use the modified Package only within your corporation or organization. c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version. d) make other distribution arrangements with the Copyright Holder. 4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following: a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version. b) accompany the distribution with the machine-readable source of the Package with your modifications. c) give non-standard executables non-standard names, and clearly document the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version. d) make other distribution arrangements with the Copyright Holder. 5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own. You may embed this Package's interpreter within an executable of yours (by linking); this shall be construed as a mere form of aggregation, provided that the complete Standard Version of the interpreter is so embedded. 6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whoever generated them, and may be sold commercially, and may be aggregated with this Package. If such scripts or library files are aggregated with this Package via the so-called "undump" or "unexec" methods of producing a binary executable image, then distribution of such an image shall neither be construed as a distribution of this Package nor shall it fall under the restrictions of Paragraphs 3 and 4, provided that you do not represent such an executable image as a Standard Version of this Package. 7. C subroutines (or comparably compiled subroutines in other languages) supplied by you and linked into this Package in order to emulate subroutines and variables of the language defined by this Package shall not be considered part of this Package, but are the equivalent of input as in Paragraph 6, provided these subroutines do not change the language in any way that would cause it to fail the regression tests for the language. 8. Aggregation of this Package with a commercial distribution is always permitted provided that the use of this Package is embedded; that is, when no overt attempt is made to make this Package's interfaces visible to the end user of the commercial distribution. Such use shall not be construed as a distribution of this Package. 9. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. 10. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. The End circle-fe-term-0.240250/MANIFEST000444001750001750 56114554723220 14541 0ustar00leoleo000000000000.editorconfig bin/circle-fe-term Build.PL Changes lib/Circle/FE/Term.pm lib/Circle/FE/Term/Ribbon.pm lib/Circle/FE/Term/Tab.pm lib/Circle/FE/Term/Widget/Box.pm lib/Circle/FE/Term/Widget/Entry.pm lib/Circle/FE/Term/Widget/Label.pm lib/Circle/FE/Term/Widget/Scroller.pm LICENSE MANIFEST This list of files META.json META.yml README share/circle-fe-term.theme t/00use.t circle-fe-term-0.240250/META.json000444001750001750 533114554723220 15051 0ustar00leoleo000000000000{ "abstract" : "Terminal frontend for the C application host", "author" : [ "Paul Evans " ], "dynamic_config" : 1, "generated_by" : "Module::Build version 0.4234", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : 2 }, "name" : "circle-fe-term", "prereqs" : { "runtime" : { "requires" : { "Convert::Color" : "0.06", "Convert::Color::XTerm" : "0", "File::ShareDir" : "1.00", "IO::Async" : "0.14", "Net::Async::Tangence::Client" : "0.15", "Object::Pad" : "0.800", "String::Tagged" : "0", "Syntax::Keyword::Match" : "0", "Tangence::ObjectProxy" : "0.20_001", "Text::Balanced" : "0", "Tickit" : "0.55", "Tickit::App::Plugin::EscapePrefix" : "0", "Tickit::Async" : "0.21", "Tickit::Event" : "0.58", "Tickit::Style" : "0.40", "Tickit::Term" : "0.27", "Tickit::Widget::Entry" : "0.20", "Tickit::Widget::Entry::Plugin::Completion" : "0", "Tickit::Widget::HBox" : "0.32", "Tickit::Widget::Scroller" : "0.15", "Tickit::Widget::Tabbed" : "0.028", "Tickit::Widget::VBox" : "0.31", "Tickit::Window" : "0.42", "perl" : "5.026" } } }, "provides" : { "Circle::FE::Term" : { "file" : "lib/Circle/FE/Term.pm", "version" : "0.240250" }, "Circle::FE::Term::Ribbon" : { "file" : "lib/Circle/FE/Term/Ribbon.pm", "version" : "0.240250" }, "Circle::FE::Term::Tab" : { "file" : "lib/Circle/FE/Term/Tab.pm", "version" : "0.240250" }, "Circle::FE::Term::Widget::Box" : { "file" : "lib/Circle/FE/Term/Widget/Box.pm", "version" : "0.240250" }, "Circle::FE::Term::Widget::Entry" : { "file" : "lib/Circle/FE/Term/Widget/Entry.pm", "version" : "0.240250" }, "Circle::FE::Term::Widget::Label" : { "file" : "lib/Circle/FE/Term/Widget/Label.pm", "version" : "0.240250" }, "Circle::FE::Term::Widget::Scroller" : { "file" : "lib/Circle/FE/Term/Widget/Scroller.pm", "version" : "0.240250" }, "Circle::FE::Term::Widget::Scroller::Widget" : { "file" : "lib/Circle/FE/Term/Widget/Scroller.pm" } }, "release_status" : "stable", "resources" : { "license" : [ "http://dev.perl.org/licenses/" ] }, "version" : "0.240250", "x_serialization_backend" : "JSON::PP version 4.07" } circle-fe-term-0.240250/META.yml000444001750001750 364414554723220 14706 0ustar00leoleo000000000000--- abstract: 'Terminal frontend for the C application host' author: - 'Paul Evans ' build_requires: {} dynamic_config: 1 generated_by: 'Module::Build version 0.4234, CPAN::Meta::Converter version 2.150010' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: circle-fe-term provides: Circle::FE::Term: file: lib/Circle/FE/Term.pm version: '0.240250' Circle::FE::Term::Ribbon: file: lib/Circle/FE/Term/Ribbon.pm version: '0.240250' Circle::FE::Term::Tab: file: lib/Circle/FE/Term/Tab.pm version: '0.240250' Circle::FE::Term::Widget::Box: file: lib/Circle/FE/Term/Widget/Box.pm version: '0.240250' Circle::FE::Term::Widget::Entry: file: lib/Circle/FE/Term/Widget/Entry.pm version: '0.240250' Circle::FE::Term::Widget::Label: file: lib/Circle/FE/Term/Widget/Label.pm version: '0.240250' Circle::FE::Term::Widget::Scroller: file: lib/Circle/FE/Term/Widget/Scroller.pm version: '0.240250' Circle::FE::Term::Widget::Scroller::Widget: file: lib/Circle/FE/Term/Widget/Scroller.pm requires: Convert::Color: '0.06' Convert::Color::XTerm: '0' File::ShareDir: '1.00' IO::Async: '0.14' Net::Async::Tangence::Client: '0.15' Object::Pad: '0.800' String::Tagged: '0' Syntax::Keyword::Match: '0' Tangence::ObjectProxy: 0.20_001 Text::Balanced: '0' Tickit: '0.55' Tickit::App::Plugin::EscapePrefix: '0' Tickit::Async: '0.21' Tickit::Event: '0.58' Tickit::Style: '0.40' Tickit::Term: '0.27' Tickit::Widget::Entry: '0.20' Tickit::Widget::Entry::Plugin::Completion: '0' Tickit::Widget::HBox: '0.32' Tickit::Widget::Scroller: '0.15' Tickit::Widget::Tabbed: '0.028' Tickit::Widget::VBox: '0.31' Tickit::Window: '0.42' perl: '5.026' resources: license: http://dev.perl.org/licenses/ version: '0.240250' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' circle-fe-term-0.240250/README000444001750001750 20114554723220 14257 0ustar00leoleo000000000000NAME Circle::FE::Term - Terminal frontend for the Circle application host AUTHOR Paul Evans circle-fe-term-0.240250/bin000755001750001750 014554723220 14041 5ustar00leoleo000000000000circle-fe-term-0.240250/bin/circle-fe-term000555001750001750 731014554723220 16723 0ustar00leoleo000000000000#!/usr/bin/perl # You may distribute under the terms of the GNU General Public License # # (C) Paul Evans, 2010-2023 -- leonerd@leonerd.org.uk use v5.26; use warnings; use Tickit::Async; use Tickit::Widget::Tabbed 0.028; use Tickit::Widget::VBox; use Tickit::Window 0.57; # ->bind_event use Tickit::App::Plugin::EscapePrefix; use Net::Async::Tangence::Client 0.15; # ->connect_url 'family' argument use Circle::FE::Term::Tab; use Circle::FE::Term::Ribbon; use IO::Async::Loop; use Text::Balanced qw( extract_bracketed ); use Getopt::Long; my $loop = IO::Async::Loop->new(); use constant HAVE_METRICS => eval { require Metrics::Any::Adapter; }; my $IDENTITY; my $FAMILY; GetOptions( 'identity|i=s' => \$IDENTITY, 'metrics-port=i' => \my $METRICS_PORT, 'help' => sub { usage(0) }, '4|ipv4' => sub { $FAMILY = "inet4" }, '6|ipv6' => sub { $FAMILY = "inet6" }, ) or usage(1); sub usage { my ( $exitcode ) = @_; print { $exitcode ? \*STDERR : \*STDOUT } <<'EOF'; circle-fe-term [options...] [URL] Options: --identity, -i IDENTITY Use the given session identity for reconnection URL should be one of: sshunix://host/path/to/socket sshexec://host/path/to/command?with+arguments exec:///path/to/command?with+arguments tcp://host:port/ unix:///path/to/socket EOF exit $exitcode; } if( HAVE_METRICS and $METRICS_PORT ) { Metrics::Any::Adapter->import( 'Prometheus' ); require Net::Prometheus; Net::Prometheus->new->export_to_IO_Async( $loop, port => $METRICS_PORT ); }; my $URL = shift @ARGV or usage(1); if( !defined $IDENTITY ) { my $hostname = `hostname -f`; chomp $hostname; $IDENTITY = $ENV{USER} . "@" . $hostname . "/Term"; } my $client = Net::Async::Tangence::Client->new( identity => $IDENTITY, on_closed => sub { warn "Connection closed\n"; exit(0); }, on_error => sub { warn "Received MSG_ERROR: $_[0]\n"; }, ); $loop->add( $client ); my $rootobj = $client->connect_url( $URL, family => $FAMILY )->get; my $t = Tickit::Async->new; $loop->add( $t ); Tickit::App::Plugin::EscapePrefix->apply( $t ); my $top_vbox = Tickit::Widget::VBox->new; # TODO: Consider a menubar my $tabbed = Tickit::Widget::Tabbed->new( tab_position => "bottom", style => { 'b:active' => 1, 'u:active' => 1, }, tab_class => "Circle::FE::Term::Tab", ribbon_class => "Circle::FE::Term::Ribbon", ); $t->bind_key( "C-n" => sub { $tabbed->next_tab } ); $t->bind_key( "C-p" => sub { $tabbed->prev_tab } ); $top_vbox->add( $tabbed, expand => 1 ); $t->set_root_widget( $top_vbox ); my $f = $rootobj->call_method( "get_session" => [ 'tabs' ], )->then( sub { my ( $session ) = @_; $session->watch_property_with_initial( "tabs", on_set => sub { my ( $objarray ) = @_; foreach my $obj ( @$objarray ) { $tabbed->add_tab( Tickit::Widget::VBox->new, object => $obj ); } }, on_push => sub { my @new = @_; foreach my $obj ( @new ) { $tabbed->add_tab( Tickit::Widget::VBox->new, object => $obj ); } }, on_shift => sub { my ( $count ) = @_; $tabbed->remove_tab( 0 ) for 1 .. $count; }, on_splice => sub { my ( $index, $count, @objs ) = @_; # $count times, remove the one at $index, as they'll shuffle down $tabbed->remove_tab( $index ) for 1 .. $count; # TODO: I have no idea wtf is going on here foreach my $i ( 0 .. $#objs ) { my $obj = $objs[$i]; die "TODO: insert tab\n"; } }, on_move => sub { my ( $index, $delta ) = @_; $tabbed->move_tab( $index, $delta ); }, ); }); $t->adopt_future( $f ); $t->run; circle-fe-term-0.240250/lib000755001750001750 014554723220 14037 5ustar00leoleo000000000000circle-fe-term-0.240250/lib/Circle000755001750001750 014554723220 15240 5ustar00leoleo000000000000circle-fe-term-0.240250/lib/Circle/FE000755001750001750 014554723220 15532 5ustar00leoleo000000000000circle-fe-term-0.240250/lib/Circle/FE/Term.pm000444001750001750 367214554723220 17144 0ustar00leoleo000000000000# You may distribute under the terms of the GNU General Public License # # (C) Paul Evans, 2008-2023 -- leonerd@leonerd.org.uk package Circle::FE::Term 0.240250; use v5.26; use warnings; use File::ShareDir qw( dist_file ); =head1 NAME C - Terminal frontend for the C application host =cut my %theme_vars; { my $theme_filename; foreach ( $ENV{CIRCLE_FE_TERM_THEME}, "$ENV{HOME}/.circle-fe-term.theme", dist_file( "circle-fe-term", "circle-fe-term.theme" ) ) { defined $_ or next; -e $_ or next; $theme_filename = $_; last; } defined $theme_filename or die "Cannot find a circle-fe-term.theme"; open( my $themefh, "<", $theme_filename ) or die "Cannot read $theme_filename - $!"; while( <$themefh> ) { m/^\s*#/ and next; # skip comments m/^\s*$/ and next; # skip blanks m/^(\S*)=(.*)$/ and $theme_vars{$1} = $2, next; print STDERR "Unrecognised theme line: $_"; } } sub get_theme_var { my $class = shift; my ( $varname ) = @_; return $theme_vars{$varname} if exists $theme_vars{$varname}; print STDERR "No such theme variable $varname\n"; return undef; } sub translate_theme_colour { my $class = shift; my ( $colourname ) = @_; return $colourname if $colourname =~ m/^#/; # Literal #rrggbb return $theme_vars{$colourname} if exists $theme_vars{$colourname}; # hope print STDERR "No such theme colour $colourname\n"; return undef; } sub get_theme_colour { my $class = shift; my ( $varname ) = @_; return $theme_vars{$varname} if exists $theme_vars{$varname}; print STDERR "No such theme variable $varname for a colour\n"; return undef; } my %theme_pens; sub get_theme_pen { my $class = shift; my ( $varname ) = @_; return $theme_pens{$varname} ||= Tickit::Pen->new( fg => $class->get_theme_colour( $varname ) ); } =head1 AUTHOR Paul Evans =cut 0x55AA; circle-fe-term-0.240250/lib/Circle/FE/Term000755001750001750 014554723220 16441 5ustar00leoleo000000000000circle-fe-term-0.240250/lib/Circle/FE/Term/Ribbon.pm000444001750001750 1412714554723220 20374 0ustar00leoleo000000000000# You may distribute under the terms of the GNU General Public License # # (C) Paul Evans, 2012-2023 -- leonerd@leonerd.org.uk use v5.26; use warnings; use Object::Pad; package Circle::FE::Term::Ribbon 0.240250; use base qw( Tickit::Widget::Tabbed::Ribbon ); class Circle::FE::Term::Ribbon::horizontal :isa(Tickit::Widget::Tabbed::Ribbon::horizontal); use Syntax::Keyword::Match; use Tickit::Utils qw( textwidth ); use List::Util qw( max first ); Tickit::Widget->VERSION( '0.35' ); # ->render_to_rb use Tickit::Style; style_definition base => activity_fg => "cyan"; use constant orientation => "horizontal"; sub lines { 1 } sub cols { 1 } sub render_to_rb { my $self = shift; my ( $rb, $rect ) = @_; my $win = $self->window or return; my @tabs = $self->tabs; my $active = $self->active_tab; $rb->goto( 0, 0 ); my $col = 0; my $printed; if( $active ) { $rb->text( $printed = sprintf( "%d", $active->index + 1 ), $active->pen ); $col += textwidth $printed; $rb->text( $printed = sprintf( ":%s | ", $active->label ) ); $col += textwidth $printed; } my $rhs = sprintf " | total: %d", scalar @tabs; my $rhswidth = textwidth $rhs; $self->{tabpos} = \my @tabpos; if( grep { $_ != $active and $_->level > 0 } @tabs ) { my @used; # Output formats: [0] = full text # [1] = initialise level<2 names # [2] = initialise level<3 names # [3] = initialise all names # [4] = hide level<2 names, initialise others # [5] = hide all names # [6] = hide all names, hide level<2 tabs entirely # [7] = hide all names, hide level<3 tabs entirely foreach my $idx ( 0 .. $#tabs ) { my $tab = $tabs[$idx]; next if $tab == $active; next unless my $level = $tab->level; my $width_full = textwidth sprintf "%d:%s", $idx + 1, $tab->label; my $width_short = textwidth sprintf "%d:%s", $idx + 1, $tab->label_short; my $width_hide = textwidth sprintf "%d", $idx + 1; $used[0] += 1 + $width_full; $used[1] += 1 + $level < 2 ? $width_short : $width_full; $used[2] += 1 + $level < 3 ? $width_short : $width_full; $used[3] += 1 + $width_short; $used[4] += 1 + $level < 2 ? $width_hide : $width_short; $used[5] += 1 + $width_hide; $used[6] += 1 + $width_hide if $level >= 2; $used[7] += 1 + $width_hide if $level >= 3; } my $space = $win->cols - $col - $rhswidth; my $format; match( Circle::FE::Term->get_theme_var( "label_format" ) : eq ) { case( "name_and_number" ) { $format = 0 } case( "initial" ) { $format = 3 } case( "number" ) { $format = 5 } default { die "Unrecognised label_format $_"; $format = 0 } } $format++ while $format < $#used and $used[$format] > $space; my $first = 1; my $hiddencount = 0; TAB: foreach my $idx ( 0 .. $#tabs ) { my $tab = $tabs[$idx]; next if $tab == $active; next unless my $level = $tab->level; my $label; match( $format : == ) { case( 0 ) { $label = $tab->label } case( 1 ) { $label = $level < 2 ? $tab->label_short : $tab->label } case( 2 ) { $label = $level < 3 ? $tab->label_short : $tab->label } case( 3 ) { $label = $tab->label_short } case( 4 ) { $label = $level < 2 ? undef : $tab->label_short } case( 5 ) { } case( 6 ) { $level >= 2 or $hiddencount++, next TAB } case( 7 ) { $level >= 3 or $hiddencount++, next TAB } } my $text = sprintf "%d", $idx + 1; $text .= ":$label" if defined $label; { $rb->savepen; if( !$first ) { $rb->setpen( $self->get_style_pen( "activity" ) ); $rb->text( "," ); $col++; } $rb->setpen( $tab->pen ); $rb->text( $text ); my $width = textwidth $text; push @tabpos, [ $idx, $col, $width ]; $col += $width; $rb->restore; } $first = 0; } if( $hiddencount ) { my $hiddenlevel = $format >= 7 ? "level2" : "level1"; $rb->savepen; $rb->setpen( Circle::FE::Term->get_theme_pen( $hiddenlevel ) ); $rb->text( " + $hiddencount more" ); $rb->restore; } } $rb->erase_to( $win->cols - $rhswidth ); $rb->text( $rhs ); } sub scroll_to_visible { } sub activate_next { my $self = shift; my @tabs = $self->tabs; @tabs = ( @tabs[$self->active_tab_index + 1 .. $#tabs], @tabs[0 .. $self->active_tab_index - 1] ); my $max_level = max map { $_->level } @tabs; return unless $max_level > 0; my $next_tab = first { $_->level == $max_level } @tabs; $next_tab->activate if $next_tab; } my $tab_shortcuts = "1234567890" . "qwertyuiop" . "sdfghjkl;'" . "zxcvbnm,./"; sub on_key { my $self = shift; my ( $ev ) = @_; if( $ev->type eq "key" and $ev->str eq "M-a" ) { $self->activate_next; return 1; } elsif( $ev->type eq "key" and $ev->str =~ m/^M-(.)$/ and ( my $idx = index $tab_shortcuts, $1 ) > -1 ) { eval { $self->activate_tab( $idx ) }; # ignore croak on invalid index return 1; } return 0; } sub on_mouse { my $self = shift; my ( $ev ) = @_; return 0 unless $ev->line == 0; if( $ev->type eq "press" and $ev->button == 1 ) { foreach my $pos ( @{ $self->{tabpos} } ) { $self->activate_tab( $pos->[0] ), return 1 if $ev->col >= $pos->[1] and $ev->col < $pos->[1] + $pos->[2]; } } elsif( $ev->type eq "wheel" ) { $self->prev_tab if $ev->button eq "up"; $self->next_tab if $ev->button eq "down"; return 1; } } 0x55AA; circle-fe-term-0.240250/lib/Circle/FE/Term/Tab.pm000444001750001750 626114554723220 17647 0ustar00leoleo000000000000# You may distribute under the terms of the GNU General Public License # # (C) Paul Evans, 2012-2023 -- leonerd@leonerd.org.uk package Circle::FE::Term::Tab 0.240250; use v5.26; use warnings; use Tickit::Widget::Tabbed; use base qw( Tickit::Widget::Tabbed::Tab ); Tickit::Widget::Tabbed->VERSION( '0.019' ); use Tickit::Term 0.27; # setctl_str use Circle::FE::Term; use Module::Pluggable search_path => "Circle::FE::Term::Widget", sub_name => "widgets", inner => 0; # Load each widget class here to ensure compiletime failures are visible early require "$_.pm" =~ s(::)(/)gr for widgets; use Tickit::Widget::Static; sub new { my $class = shift; my ( $tabbed, %args ) = @_; my $object = delete $args{object}; my $self; my $watch_tag; if( $object->proxy_isa( "Circle.RootObj" ) ) { $args{label} = "Global"; } else { $args{label} = $object->prop( "tag" ); $watch_tag++; } $self = $class->SUPER::new( $tabbed, %args ); $self->{object} = $object; $self->{term} = $tabbed->window->term; $self->adopt_future( $object->call_method( get_widget => (), )->on_done( sub { $self->widget->add( $self->build_widget( $_[0] ), expand => 1 ); }) ); $self->adopt_future( $object->watch_property_with_initial( "level", on_set => sub { my ( $level ) = @_; $self->set_level( $level ); }, ) ); $self->adopt_future( $object->subscribe_event( "raise", on_fire => sub { $self->activate; }, ) ); if( $watch_tag ) { $self->adopt_future( $object->watch_property( "tag", on_set => sub { my ( $newtag ) = @_; $self->set_label( $newtag ); }, ) ); } $self->set_on_activated( 'activated' ); return $self; } sub adopt_future { my $self = shift; my ( $f ) = @_; my $futures = $self->{futures} //= {}; $futures->{"$f"} = $f; $f->on_ready( sub { delete $futures->{shift()}; }); } sub build_widget { my $self = shift; my ( $obj ) = @_; foreach my $type ( widgets ) { next unless $obj->proxy_isa( "Circle.Widget." . $type->type ); return $type->build( $obj, $self ); } die "Cannot build widget for $obj as I don't recognise its type - " . join( ", ", map { $_->name } $obj->proxy_isa ) . "\n"; } sub level { my $self = shift; return $self->{object}->prop( "level" ); } sub set_level { my $self = shift; my ( $level ) = @_; $self->set_pen( Circle::FE::Term->get_theme_pen( "level$level" ) ); } sub label_short { my $self = shift; my $label = $self->label; $label =~ s/([a-z0-9])([a-z0-9]+)/$1/gi; return $label; } sub activated { my $self = shift; my $object = $self->{object}; if( $object->prop("level") > 0 ) { $self->adopt_future( $object->call_method( reset_level => (), ) ); } my $tag = $object->prop("tag") // "Global"; my $title = sprintf "%s - %s", $tag, "Circle"; $self->{term}->setctl_str( icontitle_text => $title ); } 0x55AA; circle-fe-term-0.240250/lib/Circle/FE/Term/Widget000755001750001750 014554723220 17664 5ustar00leoleo000000000000circle-fe-term-0.240250/lib/Circle/FE/Term/Widget/Box.pm000444001750001750 231614554723220 21111 0ustar00leoleo000000000000# You may distribute under the terms of the GNU General Public License # # (C) Paul Evans, 2010-2023 -- leonerd@leonerd.org.uk package Circle::FE::Term::Widget::Box 0.240250; use v5.26; use warnings; use constant type => "Box"; use Tickit::Widget::HBox; use Tickit::Widget::VBox; sub build { my $class = shift; my ( $obj, $tab ) = @_; my $orientation = $obj->prop("orientation"); my $widget; if( $orientation eq "vertical" ) { $widget = Tickit::Widget::VBox->new( classes => $obj->prop( "classes" ), ); } elsif( $orientation eq "horizontal" ) { $widget = Tickit::Widget::HBox->new( classes => $obj->prop( "classes" ), ); } else { die "Unrecognised orientation '$orientation'"; } foreach my $c ( @{ $obj->prop("children") } ) { if( $c->{child} ) { my $childwidget = $tab->build_widget( $c->{child} ); $widget->add( $childwidget, expand => $c->{expand} ); } else { # Just add spacing $widget->add( Tickit::Widget::Static->new( text => " " ), expand => 1 ); } } return $widget; } Tickit::Style->load_style( <<'EOF' ); HBox.status { spacing: 1; bg: "blue"; } EOF 0x55AA; circle-fe-term-0.240250/lib/Circle/FE/Term/Widget/Entry.pm000444001750001750 1447014554723220 21506 0ustar00leoleo000000000000# You may distribute under the terms of the GNU General Public License # # (C) Paul Evans, 2010-2023 -- leonerd@leonerd.org.uk package Circle::FE::Term::Widget::Entry 0.240250; use v5.26; use warnings; use constant type => "Entry"; use Tickit::Widget::Entry::Plugin::Completion; sub build { my $class = shift; my ( $obj, $tab ) = @_; my $autoclear = $obj->prop("autoclear"); my $want_typing = $obj->can_property( "want_typing" ) && $obj->prop( "want_typing" ); my $prehistory; my $history_index; my $pending_count = 0; my $widget = Circle::FE::Term::Widget::Entry::Widget->new( classes => $obj->prop( "classes" ), tab => $tab, on_enter => sub { my ( $self, $line ) = @_; $pending_count++; $self->send_pending( $pending_count ); $tab->adopt_future( $obj->call_method( enter => $self->text, )->on_done( sub { $pending_count--; $self->send_pending( $pending_count ); })->on_fail( sub { my ( $message ) = @_; warn "Failed while sending text:\n$message"; $pending_count--; $self->send_pending( $pending_count ); }) ); $self->set_text( "" ) if $autoclear; undef $history_index; }, ( $want_typing ? ( on_typing => sub { my ( $typing ) = @_; $tab->adopt_future( $obj->call_method( typing => $typing ) ); } ) : () ), ); $tab->adopt_future( $obj->watch_property_with_initial( "text", on_set => sub { my ( $text ) = @_; $text = "" unless defined $text; $widget->set_text( $text ); }, ) ); $tab->adopt_future( $obj->watch_property_with_initial( "history", on_updated => sub {}, # We ignore this, we just want a local cache ) ); $tab->adopt_future( $obj->watch_property_with_initial( "completions", on_updated => sub {}, # We ignore this, we just want a local cache ) ); $widget->bind_keys( Up => sub { my $widget = shift; my $history = $obj->prop("history"); if( !defined $history_index ) { $prehistory = $widget->text; return 1 unless @$history; $history_index = $#$history; } elsif( $history_index == 0 ) { # Don't move return 1; } else { $history_index--; } my $line = $history->[$history_index]; $widget->set_text( $line ); $widget->set_position( length( $line ) ); # TODO: accept negative return 1; }, Down => sub { my $widget = shift; my $history = $obj->prop("history"); return 1 unless defined $history_index; if( $history_index < $#$history ) { $history_index++; } else { $widget->set_text( $prehistory ); undef $history_index; return 1; } my $line = $history->[$history_index]; $widget->set_text( $line ); $widget->set_position( length( $line ) ); return 1; }, ); Tickit::Widget::Entry::Plugin::Completion->apply( $widget, ignore_case => 1, append_after_word => "", gen_words => sub { my %args = @_; my $match = qr/^\Q$args{word}\E/i; my $at_sol = ( $args{wordpos} == 0 ); my @matches; foreach my $group ( values %{ $obj->prop("completions") } ) { next if $group->prop("only_at_sol") and not $at_sol; my $suffix = $at_sol ? $group->prop("suffix_sol") : ""; length $suffix or $suffix = " "; push @matches, map { "$_$suffix" } grep { $_ =~ $match } @{ $group->prop("items") }; } return @matches; }, ); return $widget; } Tickit::Style->load_style( <<'EOF' ); Circle::FE::Term::Widget::Entry::Widget.topic { bg: "blue"; } EOF use Object::Pad v0.800; class Circle::FE::Term::Widget::Entry::Widget :isa(Tickit::Widget::Entry); Tickit::Window->VERSION( '0.42' ); use Tickit::Async 0.21; # ->cancel_timer use Tickit::Style -copy; sub BUILDARGS { my $class = shift; my %args = @_; my $on_typing = $args{on_typing}; if( $on_typing ) { my $on_enter = $args{on_enter}; $args{on_enter} = sub { my ( $self ) = @_; $self->stopped_typing; $on_enter->( @_ ); }; } return %args; } field $tab :param; field $on_typing :param = undef; field $typing_timer_id; method on_key { my ( $ev ) = @_; $tab->activated; my $ret = $self->SUPER::on_key( @_ ); if( $ret && $on_typing and length $self->text ) { my $tickit = $self->window->tickit; if( $typing_timer_id ) { $tickit->cancel_timer( $typing_timer_id ); } else { $self->started_typing; } $typing_timer_id = $tickit->timer( after => 5, sub { $self->stopped_typing }); } return $ret; } method started_typing { $on_typing->( 1 ); } method stopped_typing { $self->window->tickit->cancel_timer( $typing_timer_id ) if defined $typing_timer_id; undef $typing_timer_id; $on_typing->( 0 ); } field $pending_count; field $pending_window; method send_pending { my ( $count ) = @_; $pending_count = $count; if( $count ) { my $win = $pending_window ||= do { my $win = $self->window->make_hidden_sub( 0, $self->window->cols - 12, 1, 12 ); my $countr = \$pending_count; $win->bind_event( expose => sub { my ( $win, undef, $info ) = @_; my $rb = $info->rb; $rb->goto( 0, 0 ); $rb->text( "Sending $$countr..." ); $rb->erase_to( 12 ); }); $win->pen->chattrs({ fg => "black", bg => "cyan", i => 1 }); $win; }; if( !$win->is_visible ) { # TODO: Use Tickit->timer when it comes out $win->tickit->loop->watch_time( after => 0.5, code => sub { $win->show if $pending_count and !$win->is_visible; }); } $win->expose if $win->is_visible; } elsif( my $win = $pending_window ) { $win->hide; } } 0x55AA; circle-fe-term-0.240250/lib/Circle/FE/Term/Widget/Label.pm000444001750001750 134714554723220 21403 0ustar00leoleo000000000000# You may distribute under the terms of the GNU General Public License # # (C) Paul Evans, 2011-2023 -- leonerd@leonerd.org.uk package Circle::FE::Term::Widget::Label 0.240250; use v5.26; use warnings; use constant type => "Label"; use Tickit::Widget::Static; sub build { my $class = shift; my ( $obj, $tab ) = @_; my $widget = Tickit::Widget::Static->new( classes => $obj->prop( "classes" ), text => "", ); $tab->adopt_future( $obj->watch_property_with_initial( "text", on_set => sub { $widget->set_text( $_[0] ) }, ) ); return $widget; } Tickit::Style->load_style( <<'EOF' ); Static.ident { bg: "blue"; } Static.transient { fg: "yellow"; b: 1; } EOF 0x55AA; circle-fe-term-0.240250/lib/Circle/FE/Term/Widget/Scroller.pm000444001750001750 2235014554723220 22166 0ustar00leoleo000000000000# You may distribute under the terms of the GNU General Public License # # (C) Paul Evans, 2010-2023 -- leonerd@leonerd.org.uk package Circle::FE::Term::Widget::Scroller 0.240250; use v5.26; use warnings; use constant type => "Scroller"; use Syntax::Keyword::Match; use Circle::FE::Term; use Convert::Color 0.06; use Convert::Color::XTerm; use POSIX qw( strftime ); use String::Tagged; use Text::Balanced qw( extract_bracketed ); use Tangence::ObjectProxy '0.16'; # watch with iterators # Guess that we can do 256 colours on xterm or any -256color terminal my $AS_TERM = ( $ENV{TERM} eq "xterm" or $ENV{TERM} =~ m/-256color$/ ) ? "as_xterm" : "as_vga"; sub build { my $class = shift; my ( $obj, $tab ) = @_; my $widget = Circle::FE::Term::Widget::Scroller::Widget->new( classes => $obj->prop( "classes" ), gravity => "bottom", ); my $self = bless { tab => $tab, widget => $widget, last_datestamp => "", last_datestamp_top => "", }; $widget->set_on_scrolled( sub { $self->maybe_request_more if $_[1] < 0 } ); $tab->adopt_future( $obj->watch_property_with_iter( "displayevents", "last", on_set => sub { die "This should not happen\n"; }, on_push => sub { $self->insert_event( bottom => $_ ) for @_; }, on_shift => sub { my ( $count ) = @_; $count -= $self->{iter_idx}; $widget->shift( $count ) if $count > 0; }, )->then( sub { ( $self->{iter}, undef, my $max ) = @_; $self->{iter_idx} = $max + 1; $self->maybe_request_more; }) ); return $widget; } sub maybe_request_more { my $self = shift; my $widget = $self->{widget}; my $idx = $self->{iter_idx}; my $height = $widget->window->lines; return if $self->{iter_fetching}; # Stop if we've got at least 2 screenfuls more, or we're out of things to iterate if( $widget->lines_above > $height * 2 or !$idx ) { $widget->set_loading( 0 ); return; } my $more = $height * 3; $more = $idx if $more > $idx; $self->{iter_fetching} = 1; $widget->set_loading( 1 ); my $f = $self->{iter}->next_backward( $more ) ->on_done( sub { ( $self->{iter_idx}, my @more ) = @_; $self->{iter_fetching} = 0; $self->insert_event( top => $_ ) for reverse @more; $self->maybe_request_more; }); $self->{tab}->adopt_future( $f ); } sub insert_event { my $self = shift; my ( $end, $ev ) = @_; my ( $event, $time, $args ) = @$ev; my $tab = $self->{tab}; my @time = localtime( $time ); my $datestamp = strftime( Circle::FE::Term->get_theme_var( "datestamp" ), @time ); my $timestamp = strftime( Circle::FE::Term->get_theme_var( "timestamp" ), @time ); my $format = Circle::FE::Term->get_theme_var( $event ); defined $format or $format = "No format defined for event $event"; my @items = ( $self->format_event( $timestamp . $format, $args ) ); my $widget = $self->{widget}; match( $end : eq ) { case( "bottom" ) { unshift @items, $self->format_event( Circle::FE::Term->get_theme_var( "datemessage" ), { datestamp => $datestamp } ) if $datestamp ne $self->{last_datestamp}; $widget->push( @items ); $self->{last_datestamp} = $datestamp; } case( "top" ) { push @items, $self->format_event( Circle::FE::Term->get_theme_var( "datemessage" ), { datestamp => $self->{last_datestamp_top} } ) if $datestamp ne $self->{last_datestamp_top} and length $self->{last_datestamp_top}; $widget->unshift( @items ); $self->{last_datestamp_top} = $datestamp; $self->{last_datestamp} = $datestamp if !length $self->{last_datestamp}; } } } sub format_event { my $self = shift; my ( $format, $args ) = @_; my $str = String::Tagged->new(); $self->_apply_formatting( $format, $args, $str ); my $indent = 4; if( grep { $_ eq "indent" } $str->tagnames and my $extent = $str->get_tag_missing_extent( 0, "indent" ) ) { # TODO: Should use textwidth not just char. count $indent = $extent->end; } return Tickit::Widget::Scroller::Item::RichText->new( $str, indent => $indent ); } my %colourcache; sub _convert_colour { my $self = shift; my ( $colspec ) = @_; return undef if !defined $colspec; return $colourcache{$colspec} ||= sub { return Convert::Color->new( "rgb8:$1$1$2$2$3$3" )->$AS_TERM->index if $colspec =~ m/^#([0-9A-F])([0-9A-F])([0-9A-F])$/i; return Convert::Color->new( "rgb8:$1$2$3" )->$AS_TERM->index if $colspec =~ m/^#([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})$/i; return Convert::Color->new( "vga:$colspec" )->index if $colspec =~ m/^[a-z]+$/; print STDERR "TODO: Unknown colour spec $colspec\n"; 6; # TODO }->(); } sub _apply_formatting { my $self = shift; my ( $format, $args, $str ) = @_; while( length $format ) { if( $format =~ s/^\$(\w+)// ) { my $val = exists $args->{$1} ? $args->{$1} : ""; defined $val or $val = ""; my @parts = ref $val eq "ARRAY" ? @$val : ( $val ); my $is_initial = 1; my $needs_linefeed; foreach my $part ( @parts ) { my ( $text, %format ) = ref $part eq "ARRAY" ? @$part : ( $part ); $str->append( "\n" ) if $needs_linefeed; $needs_linefeed = 0; # Convert some tags if( delete $format{m} ) { # Monospace $format{af} = 1; $format{bg} = "#303030"; } if( delete $format{bq} ) { # Quoted text $format{bg} = "#303030"; $format{fg} = "#00C0C0"; # blockquotes get to be on their own line, with "> " prefixed on each $text = join( "\n", map { "> $_" } split m/\n/, $text ); # surround the text by linefeeds $str->append( "\n" ) if !$is_initial; $needs_linefeed++; } # Tickit::Widget::Scroller::Item::Text doesn't like C0, C1 or DEL # control characters. Replace them with U+FFFD # Be sure to leave linefeed alone $text =~ s/[\x00-\x09\x0b-\x1f\x80-\x9f\x7f]/\x{fffd}/g; foreach (qw( fg bg )) { defined $format{$_} or next; $format{$_} = $self->_convert_colour( Circle::FE::Term->translate_theme_colour( $format{$_} ) ); } $str->append_tagged( $text, %format ); $is_initial = 0; } } elsif( $format =~ m/^\{/ ) { my $piece = extract_bracketed( $format, "{}" ); s/^{//, s/}$// for $piece; if( $piece =~ m/^\?\$/ ) { # A conditional expansion in three parts # {?$varname|IFTRUE|IFFALSE} my ( $varname, $iftrue, $iffalse ) = split( m/\|/, $piece, 3 ); $varname =~ s/^\?\$//; if( defined $args->{$varname} ) { $self->_apply_formatting( $iftrue, $args, $str ); } else { $self->_apply_formatting( $iffalse, $args, $str ); } } elsif( $piece =~ m/ / ) { my ( $code, $content ) = split( m/ /, $piece, 2 ); my ( $type, $arg ) = split( m/:/, $code, 2 ); my $start = length $str->str; $self->_apply_formatting( $content, $args, $str ); my $end = length $str->str; $arg = $self->_convert_colour( $arg ) if $type eq "fg" or $type eq "bg"; $str->apply_tag( $start, $end - $start, $type => $arg ); } else { $self->_apply_formatting( $piece, $args, $str ); } } else { $format =~ s/^([^\$\{]+)//; my $val = $1; $str->append( $val ); } } } package Circle::FE::Term::Widget::Scroller::Widget; use base qw( Tickit::Widget::Scroller ); Tickit::Widget::Scroller->VERSION( 0.15 ); # on_scrolled use Tickit::Widget::Scroller::Item::RichText; sub new { my $class = shift; return $class->SUPER::new( @_, gen_bottom_indicator => "gen_bottom_indicator", gen_top_indicator => "gen_top_indicator", ); } sub clear_lines { my $self = shift; undef @{ $self->{lines} }; my $window = $self->window or return; $window->clear; $window->restore; } sub push { my $self = shift; my $below_before = $self->lines_below; $self->SUPER::push( @_ ); if( $below_before ) { $self->{more_count} += $self->lines_below - $below_before; $self->update_indicators; } } sub set_loading { my $self = shift; my ( $loading ) = @_; return if $loading == ( $self->{loading} // 0 ); $self->{loading} = $loading; $self->update_indicators; } sub gen_bottom_indicator { my $self = shift; my $below = $self->lines_below; if( !$below ) { undef $self->{more_count}; return; } if( $self->{more_count} ) { return sprintf "-- +%d [%d more] --", $below - $self->{more_count}, $self->{more_count}; } else { return sprintf "-- +%d --", $below; } } sub gen_top_indicator { my $self = shift; return $self->{loading} ? " Loading... " : undef; } 0x55AA; circle-fe-term-0.240250/share000755001750001750 014554723220 14373 5ustar00leoleo000000000000circle-fe-term-0.240250/share/circle-fe-term.theme000444001750001750 722014554723220 20353 0ustar00leoleo000000000000# use colour 16 so it doesn't do bold=grey level0=16 level1=cyan level2=white level3=magenta highlight=yellow #RRGGBB ansi.col00=#000000 ansi.col01=#990000 ansi.col02=#00bb00 ansi.col03=#bbbb00 ansi.col04=#0000ff ansi.col05=#bb00bb ansi.col06=#00bbbb ansi.col07=#999999 ansi.col08=#606060 ansi.col09=#ff0000 ansi.col10=#00ff00 ansi.col11=#ffff00 ansi.col12=#6868ff ansi.col13=#ff00ff ansi.col14=#00ffff ansi.col15=#ffffff timestamp={fg:#0DD %H:%M} datestamp=%Y/%m/%d datemessage={fg:#55F {fg:#0DD --:--}} {indent Day is now $datestamp} label_format=name_and_number # Generic events response={fg:white -{fg:blue !}-} {indent $text} warning={fg:white -{fg:#FB2 {b !}}-} {fg:#FB2 {indent $text}} error={fg:white -{fg:red {b !}}-} {bg:#B33 {fg:black $text}} status={fg:white -{fg:green {b *}}-} {indent $text} text=$text # IRC events irc.irc={fg:red <$prefix>} $command $args irc.text={fg:cyan -{fg:white $server}-} $text irc.motd={fg:blue MOTD:} $text irc.join={fg:#0B0 ***} {fg:#5F5 Joins:} {indent }{fg:#0DD $nick} {fg:#888 [{fg:#55F $userhost}]} has joined {fg:#5F5 $channel} irc.part={fg:#806000 ***} {fg:#FB3 Parts:} {indent }{fg:#0DD $nick} {fg:#888 [{fg:#55F $userhost}]} has left {fg:#5F5 $channel} ({i $partmsg}) irc.kick={fg:#806000 ***} {fg:#FB3 Kicks:} {indent }{fg:#0DD $kicked} {fg:#888 [{fg:#55F kickeduser@kickedhost}]} was kicked from {fg:#5F5 $channel} by {fg:#55F $kicker} ({i $kickmsg}) irc.quit={fg:#B00 ***} {fg:#F55 Quits:} {indent }{fg:#0DD $nick} {fg:#888 [{fg:#55F $userhost}]} ({i $quitmsg}) irc.nick={fg:#0DD ***} {fg:#5FF $oldnick} is now known as {fg:#5FF $newnick} irc.topic={fg:#55F ***} {fg:#0DD {fg:#5FF Topic} change by {fg:#5FF $nick} on {fg:#5F5 $channel}:} {indent $topic} irc.topic_is={fg:#55F ***} {fg:#0DD {fg:#5FF Topic} on {fg:#5F5 $channel} is:} {indent $topic} irc.topic_by={fg:#55F ***} {fg:#0DD {fg:#5FF Topic} on {fg:#5F5 $channel} set by {fg:#55F $topic_by} on $timestamp} irc.mode={fg:#0DD ***} {fg:#5FF Mode} change for {fg:#5F5 $channel} by {fg:#5FF $moder}: {fg:#5FF $mode} irc.mode_is={fg:#0DD ***} {fg:#5FF Mode} for {fg:#5F5 $channel}: {indent }{fg:#5FF $mode} irc.msg={fg:#D8D <{fg:white $nick}>} {indent $text} irc.notice={fg:white -{fg:#D8D $nick}-} {indent $text} irc.act={fg:#D8D * $nick} {indent $text} irc.away={fg:#088 ***} {fg:#299 $nick} {fg:#999 is away:} {indent $text} irc.online={fg:#0DD *** $nick} is now {fg:#8F8 online} irc.offline={fg:#0DD *** $nick} is now {fg:#F88 offline} # Matrix events matrix.text={fg:#D8D <{fg:white {?$name|$name|{i:1 $user_id}}}>} {indent $text} matrix.notice={fg:white -{fg:#D8D {?$name|$name|{i:1 $user_id}}}-} {fg:#AAA {indent $text}} matrix.emote={fg:#D8D * {?$name|$name|{i:1 $user_id}}} {indent $text} matrix.media={fg:#D8D {?$name|$name|{i:1 $user_id}}} sends {fg:#D8D $type}: {indent }$url - {fg:#D8D $detail} matrix.invite={fg:#960 ***} {fg:#EB3 Invites:} {indent }{fg:#5FF {?$name|$name|{i:1 $user_id}}} invited {fg:#5FF {?$invitee|$invitee|{i:1 $invitee_id}}} matrix.join={fg:#0B0 ***} {fg:#5F5 Joins:} {indent }{?$name|{fg:#0DD $name} {fg:#888 [{fg:#55F $user_id}]}|{fg:#0DD {i:1 $user_id}}} has joined matrix.leave={fg:#B00 ***} {fg:#F55 Leaves:} {indent }{fg:#0DD {?$name|$name|{i:1 $user_id}}} has left matrix.rename={fg:#0DD ***} {?$oldname|{fg:#5FF $oldname} {fg:#888 [{fg:#55F $user_id}]}|{fg:#5FF {i:1 $user_id}}} is now known as {fg:#5FF $newname} matrix.member={fg:#960 ***} {fg:#EB3 Member:} {indent }{fg:#5FF {?$name|$name|{i:1 $user_id}}} set {fg:#5FF $subject} {fg:#999 $state} to {fg:#EB3 $newval} matrix.state={fg:#880 ***} {fg:#DD3 State:} {indent }{fg:#5FF {?$name|$name|{i:1 $user_id}}} {?$oldval|changed {fg:#DD8 $state} from {fg:#DD8 $oldval}|set {fg:#DD8 $state}} to {fg:#DD8 $newval} circle-fe-term-0.240250/t000755001750001750 014554723220 13534 5ustar00leoleo000000000000circle-fe-term-0.240250/t/00use.t000444001750001750 55114554723220 14773 0ustar00leoleo000000000000#!/usr/bin/perl use v5.26; use warnings; use Test::More; use_ok( "Circle::FE::Term" ); use_ok( "Circle::FE::Term::Tab" ); use_ok( "Circle::FE::Term::Ribbon" ); use_ok( "Circle::FE::Term::Widget::Box" ); use_ok( "Circle::FE::Term::Widget::Scroller" ); use_ok( "Circle::FE::Term::Widget::Label" ); use_ok( "Circle::FE::Term::Widget::Entry" ); done_testing;