Skip to content

Commit

Permalink
add empty line at bottom when mouse click there
Browse files Browse the repository at this point in the history
  • Loading branch information
neoe committed Feb 23, 2023
1 parent bce5e6e commit 7cd7cd7
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 25 deletions.
Binary file modified dist/neoeedit.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion src/neoe/ne/BasicEdit.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ boolean record ;
this . pd = data ;
}

void insertEmptyLine ( int y ) {
public void insertEmptyLine ( int y ) {
if ( y > lines ( ) . size ( ) )
y = lines ( ) . size ( ) ;
lines ( ) . add ( y , new StringBuilder ( ) ) ;
Expand Down
54 changes: 31 additions & 23 deletions src/neoe/ne/PlainPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -451,25 +451,26 @@ public void mouseClicked ( MouseEvent evt ) {
return ;
}
int my1 = evt . getY ( ) ;
if ( my1 > 0 && my1 < toolbarHeight )
if ( pageData . fileLoaded ) {
U . setClipBoard ( pageData . title ) ;
ui . message ( "filename copied" ) ;
my1 = 0 ;
// repaint();
} else if ( workPath != null ) {
U . setClipBoard ( workPath ) ;
ui . message ( "work path copied" ) ;
my1 = 0 ;
} else
try {
if ( U . saveFile ( this ) )
ui . message ( "saved" ) ;
} catch ( Throwable e ) {
ui . message ( "err:" + e ) ;
e . printStackTrace ( ) ;
}
else {
if ( my1 > 0 && my1 < toolbarHeight ) {
if ( pageData . fileLoaded ) {
U . setClipBoard ( pageData . title ) ;
ui . message ( "filename copied" ) ;
my1 = 0 ;
// repaint();
} else if ( workPath != null ) {
U . setClipBoard ( workPath ) ;
ui . message ( "work path copied" ) ;
my1 = 0 ;
} else {
try {
if ( U . saveFile ( this ) )
ui . message ( "saved" ) ;
} catch ( Throwable e ) {
ui . message ( "err:" + e ) ;
e . printStackTrace ( ) ;
}
}
} else {
int mx1 = evt . getX ( ) ;
if ( mx1 > 0 && mx1 < ui . gutterWidth ) {
cursor . gotoLine ( ) ;
Expand Down Expand Up @@ -1956,8 +1957,9 @@ public void run ( ) {
final int maxw = dim . width - gutterWidth ;
final int maxw2 = ( int ) ( maxw / scalev ) ;
{ // change cy if needed
if ( cy >= pageData . roLines . getLinesize ( ) )
cy = Math . max ( 0 , pageData . roLines . getLinesize ( ) - 1 ) ;
if ( cy >= pageData . roLines . getLinesize ( ) ) {
cy = Math . max ( 0 , pageData . roLines . getLinesize ( ) - 1 ) ;
}
}

g2 . setColor ( colorBg ) ;
Expand Down Expand Up @@ -1997,8 +1999,14 @@ public void run ( ) {
mx = ( int ) ( mx / scalev ) ;
my = ( int ) ( my / scalev ) ;
cy = sy + my / ( lineHeight + lineGap ) ;
if ( cy >= pageData . roLines . getLinesize ( ) )
cy = pageData . roLines . getLinesize ( ) - 1 ;
if ( cy >= pageData . roLines . getLinesize ( ) ) {
// add a empty line for sake
if ( ! readonly && pageData . roLines . getline ( pageData . roLines . getLinesize ( ) - 1 )
. length ( ) > 0 ) {
pageData . editRec . insertEmptyLine ( cy ) ;
}
cy = pageData . roLines . getLinesize ( ) - 1 ;
}
mousePos = true ;
} { // highlight current line
int l1 = cy - sy ;
Expand Down
2 changes: 1 addition & 1 deletion src/neoe/ne/Version.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package neoe . ne ;

public class Version {
public static final String REV = "v383rc4" . toString ( ) ; // β
public static final String REV = "v383rc5" . toString ( ) ; // β
public static final String CONFIG_FN = "/data.py.ver42" . toString ( ) ;
}

0 comments on commit 7cd7cd7

Please sign in to comment.