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
a7da79f4
Commit
a7da79f4
authored
5 years ago
by
echicken
Browse files
Options
Downloads
Patches
Plain Diff
Input position was offset incorrectly if prompt had ctrl-a codes, fixed
with strip_ctrl.
parent
a956d845
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
exec/load/typeahead.js
+27
-40
27 additions, 40 deletions
exec/load/typeahead.js
with
27 additions
and
40 deletions
exec/load/typeahead.js
+
27
−
40
View file @
a7da79f4
...
...
@@ -276,14 +276,10 @@ var Typeahead = function (options) {
properties
.
position
=
properties
.
text
.
length
+
1
;
}
if
(
typeof
options
.
datasources
!==
'
undefined
'
&&
Array
.
isArray
(
options
.
datasources
)
)
{
properties
.
datasources
=
options
.
datasources
.
filter
(
function
(
d
)
{
return
(
typeof
d
===
'
function
'
);
}
);
if
(
typeof
options
.
datasources
!==
'
undefined
'
&&
Array
.
isArray
(
options
.
datasources
))
{
properties
.
datasources
=
options
.
datasources
.
filter
(
function
(
d
)
{
return
(
typeof
d
===
'
function
'
);
});
}
}
...
...
@@ -306,7 +302,7 @@ var Typeahead = function (options) {
display
.
frame
.
putmsg
(
properties
.
prompt
);
display
.
inputFrame
=
new
Frame
(
display
.
frame
.
x
+
properties
.
prompt
.
length
,
display
.
frame
.
x
+
strip_ctrl
(
properties
.
prompt
)
.
length
,
display
.
frame
.
y
,
properties
.
len
,
1
,
...
...
@@ -349,11 +345,9 @@ var Typeahead = function (options) {
function
suggest
()
{
var
suggestions
=
[];
properties
.
datasources
.
forEach
(
function
(
datasource
)
{
suggestions
=
suggestions
.
concat
(
datasource
(
properties
.
text
));
}
);
properties
.
datasources
.
forEach
(
function
(
datasource
)
{
suggestions
=
suggestions
.
concat
(
datasource
(
properties
.
text
));
});
if
(
typeof
display
.
tree
!=
'
undefined
'
)
{
display
.
tree
.
close
();
...
...
@@ -372,18 +366,14 @@ var Typeahead = function (options) {
display
.
tree
.
colors
.
lbg
=
properties
.
hsbg
;
display
.
tree
.
addItem
(
''
);
suggestions
.
forEach
(
function
(
suggestion
)
{
if
(
typeof
suggestion
===
'
object
'
&&
typeof
suggestion
.
text
===
'
string
'
)
{
var
item
=
display
.
tree
.
addItem
(
suggestion
.
text
);
item
.
suggestion
=
suggestion
;
}
else
if
(
typeof
suggestion
===
'
string
'
)
{
display
.
tree
.
addItem
(
suggestion
);
}
suggestions
.
forEach
(
function
(
suggestion
)
{
if
(
typeof
suggestion
===
'
object
'
&&
typeof
suggestion
.
text
===
'
string
'
)
{
var
item
=
display
.
tree
.
addItem
(
suggestion
.
text
);
item
.
suggestion
=
suggestion
;
}
else
if
(
typeof
suggestion
===
'
string
'
)
{
display
.
tree
.
addItem
(
suggestion
);
}
);
}
);
display
.
tree
.
open
();
...
...
@@ -454,9 +444,7 @@ var Typeahead = function (options) {
break
;
case
'
\r
'
:
case
'
\n
'
:
if
(
typeof
display
.
tree
!==
'
undefined
'
&&
display
.
tree
.
index
>
0
)
{
if
(
typeof
display
.
tree
!==
'
undefined
'
&&
display
.
tree
.
index
>
0
)
{
if
(
typeof
display
.
tree
.
currentItem
.
suggestion
===
'
undefined
'
)
{
ret
=
display
.
tree
.
currentItem
.
text
;
}
else
{
...
...
@@ -559,19 +547,18 @@ var Typeahead = function (options) {
display
.
frame
.
delete
();
}
this
.
__defineGetter__
(
'
focus
'
,
function
()
{
return
properties
.
focus
;
});
this
.
__defineSetter__
(
'
focus
'
,
function
(
bool
)
{
if
(
typeof
bool
!==
'
boolean
'
)
return
;
properties
.
focus
=
bool
;
if
(
!
bool
)
{
display
.
cursor
.
bottom
();
}
else
{
display
.
cursor
.
top
();
}
this
.
__defineGetter__
(
'
focus
'
,
function
()
{
return
properties
.
focus
;
});
this
.
__defineSetter__
(
'
focus
'
,
function
(
bool
)
{
if
(
typeof
bool
!==
'
boolean
'
)
return
;
properties
.
focus
=
bool
;
if
(
!
bool
)
{
display
.
cursor
.
bottom
();
}
else
{
display
.
cursor
.
top
();
}
);
}
);
init
();
...
...
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