File tree Expand file tree Collapse file tree 5 files changed +17
-11
lines changed Expand file tree Collapse file tree 5 files changed +17
-11
lines changed Original file line number Diff line number Diff line change
1
+ .caret {
2
+ position : absolute;
3
+ height : 2.6vh ;
4
+ left : 1px ;
5
+ border-right : 1px solid black;
6
+
7
+ transition : 0.07s ;
8
+ }
Original file line number Diff line number Diff line change @@ -17,15 +17,6 @@ body {
17
17
z-index : 0 ;
18
18
}
19
19
20
- .caret {
21
- position : absolute;
22
- height : 2.6vh ;
23
- left : 1px ;
24
- border-right : 1px solid black;
25
-
26
- transition : 0.07s ;
27
- }
28
-
29
20
.line {
30
21
position : relative;
31
22
top : 0px ;
Original file line number Diff line number Diff line change 3
3
4
4
< head >
5
5
< link rel ="stylesheet " type ="text/css " href ="css/index.css ">
6
+ < link rel ="stylesheet " type ="text/css " href ="css/caret.css ">
6
7
</ head >
7
8
8
9
< body >
Original file line number Diff line number Diff line change @@ -24,7 +24,13 @@ Caret.prototype = {
24
24
let top , left ;
25
25
if ( this . row == 1 ) top = 0 ;
26
26
else top = $ ( `.line:nth-child(${ this . row } )` ) . position ( ) . top ;
27
- if ( this . col == 1 || el == undefined ) left = 15 ;
27
+ if ( this . col == 1 || el == undefined ) {
28
+ if ( el == undefined ) {
29
+ left = $ ( `.line:nth-child(${ this . row } ) .linenum` ) . width ( ) + 10 ;
30
+ console . log ( `> ${ left } ` ) ;
31
+ } else
32
+ left = 15 ;
33
+ }
28
34
else left = $ ( el ) . position ( ) . left + $ ( el ) . width ( ) ;
29
35
30
36
caretElement . style . top = `${ top } px` ;
Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ const keyToChar = function(keyCode) {
46
46
// KEYDOWN
47
47
const handleKeyDown = function ( keyCode ) {
48
48
var tmpkey = String . fromCharCode ( keyCode ) ;
49
- console . log ( tmpkey + ' ' + keyCode ) ;
49
+ // console.log(tmpkey + ' ' + keyCode);
50
50
51
51
// TRIGGER HELPER KEYS: CTRL, SHIFT
52
52
if ( keyCode == shiftKey . keyCode ) {
You can’t perform that action at this time.
0 commit comments