Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
ae18b2d4
Commit
ae18b2d4
authored
4 years ago
by
echicken
Browse files
Options
Downloads
Patches
Plain Diff
Mouse support, for scrolling and clicking on clickable items.
parent
49dbd08a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
xtrn/go-for/go-for.js
+30
-3
30 additions, 3 deletions
xtrn/go-for/go-for.js
with
30 additions
and
3 deletions
xtrn/go-for/go-for.js
+
30
−
3
View file @
ae18b2d4
load
(
'
sbbsdefs.js
'
);
load
(
'
scrollbox.js
'
);
load
(
'
typeahead.js
'
);
require
(
"
mouse_getkey.js
"
,
"
mouse_getkey
"
);
const
ansiterm
=
load
({},
'
ansiterm_lib.js
'
);
/* To do
* - Config file
...
...
@@ -58,6 +60,11 @@ const state = {
fn
:
''
};
function
mouse_enable
(
enable
)
{
if
(
!
console
.
term_supports
(
USER_ANSI
))
return
;
ansiterm
.
send
(
'
mouse
'
,
enable
?
'
set
'
:
'
clear
'
,
'
normal_tracking
'
);
}
function
is_link
(
str
)
{
return
str
.
search
(
/
[
0-9
\+
gIT
]
/
)
>
-
1
;
}
...
...
@@ -387,14 +394,34 @@ function print_document(auto_highlight) {
}
function
main
()
{
js
.
on_exit
(
'
mouse_enable(false);
'
);
js
.
on_exit
(
'
bbs.sys_status =
'
+
bbs
.
sys_status
+
'
;
'
);
js
.
on_exit
(
'
console.attributes =
'
+
console
.
attributes
+
'
;
'
);
scrollbox
.
init
();
reset_display
();
mouse_enable
(
true
);
go_get
(
state
.
host
,
state
.
port
,
state
.
selector
,
state
.
item_type
);
console
.
gotoxy
(
console
.
screen_columns
,
console
.
screen_rows
);
var
actioned
=
true
;
do
{
state
.
input
=
mouse_getkey
(
K_NONE
,
undefined
,
true
);
if
(
!
state
.
input
)
continue
;
var
actioned
=
true
;
switch
(
state
.
input
)
{
if
(
state
.
input
.
mouse
&&
state
.
input
.
mouse
.
press
)
{
var
mret
=
scrollbox
.
getcmd
(
state
.
input
);
if
(
typeof
mret
!=
'
number
'
)
{
console
.
gotoxy
(
console
.
screen_columns
,
console
.
screen_rows
);
continue
;
}
if
(
mret
<
state
.
doc
.
length
&&
is_link
(
state
.
doc
[
mret
].
type
))
{
lowlight
(
state
.
doc
[
state
.
item
],
state
.
item
);
state
.
item
=
mret
;
state
.
history
[
state
.
history_idx
].
item
=
mret
;
highlight
(
state
.
doc
[
state
.
item
],
state
.
item
);
state
.
input
.
key
=
'
\r
'
;
}
}
state
.
input
.
key
=
state
.
input
.
key
.
toLowerCase
();
switch
(
state
.
input
.
key
)
{
// Highlight next link
case
'
\t
'
:
if
(
state
.
item_type
==
'
1
'
||
state
.
item_type
==
'
7
'
)
{
...
...
@@ -484,7 +511,7 @@ function main() {
break
;
}
if
(
actioned
)
console
.
gotoxy
(
console
.
screen_columns
,
console
.
screen_rows
);
}
while
(
(
state
.
input
=
console
.
getkey
()).
toLowerCase
()
!=
'
q
'
);
}
while
(
state
.
input
.
key
!=
'
q
'
);
scrollbox
.
close
();
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment