diff --git a/.gitignore b/.gitignore index db613ff49..c96079bbf 100644 --- a/.gitignore +++ b/.gitignore @@ -38,6 +38,7 @@ external_projects.lua src/thirdparty/SDL2/include/SDL2 projects/ios/eepp.app/assets projects/ios/eepp.app/eepp +bin/*.so bin/*.dylib *.iml .idea/ diff --git a/src/eepp/ui/doc/textdocument.cpp b/src/eepp/ui/doc/textdocument.cpp index db0c8f5f1..6f7f9ccf5 100644 --- a/src/eepp/ui/doc/textdocument.cpp +++ b/src/eepp/ui/doc/textdocument.cpp @@ -507,7 +507,6 @@ bool TextDocument::save( IOStream& stream, bool keepUndoRedoStatus ) { if ( !stream.isOpen() || mLines.empty() ) return false; const std::string whitespaces( " \t\f\v\n\r" ); - char nl = '\n'; if ( mIsBOM ) { unsigned char bom[] = { 0xEF, 0xBB, 0xBF }; stream.write( (char*)bom, sizeof( bom ) ); @@ -518,19 +517,13 @@ bool TextDocument::save( IOStream& stream, bool keepUndoRedoStatus ) { if ( !keepUndoRedoStatus && mTrimTrailingWhitespaces && text.size() > 1 && whitespaces.find( text[text.size() - 2] ) != std::string::npos ) { size_t pos = text.find_last_not_of( whitespaces ); - size_t oriSize = text.size(); + Int64 curLine = i; if ( pos != std::string::npos ) { - text.erase( pos + 1 ); - text += nl; + remove( 0, { { curLine, static_cast( pos + 1 ) }, + { curLine, static_cast( mLines[i].getText().size() ) } } ); } else { - text = nl; + remove( 0, { startOfLine( { curLine, 0 } ), { endOfLine( { curLine, 0 } ) } } ); } - mLines[i].setText( text ); - notifyLineChanged( i ); - notifyTextChanged( - { { { static_cast( i ), static_cast( oriSize ) }, - { static_cast( i ), static_cast( text.size() - 1 ) } }, - "" } ); } if ( i == lastLine ) { if ( !text.empty() && text[text.size() - 1] == '\n' ) { @@ -542,14 +535,7 @@ bool TextDocument::save( IOStream& stream, bool keepUndoRedoStatus ) { if ( !keepUndoRedoStatus && mForceNewLineAtEndOfFile && !text.empty() && text[text.size() - 1] != '\n' ) { text += "\n"; - mLines.emplace_back( TextDocumentLine( "\n" ) ); - notifyTextChanged( { { TextPosition{ static_cast( i ), - static_cast( mLines[i].size() - 1 ) }, - TextPosition{ static_cast( i ), - static_cast( mLines[i].size() - 1 ) } }, - "\n" } ); - notifyLineChanged( i ); - notifyLineCountChanged( lastLine, lastLine + 1 ); + insert( 0, endOfDoc(), "\n" ); } } if ( mLineEnding == LineEnding::CRLF ) { diff --git a/src/tools/ecode/filesystemlistener.cpp b/src/tools/ecode/filesystemlistener.cpp index 88a9d379d..ffa2f0ba7 100644 --- a/src/tools/ecode/filesystemlistener.cpp +++ b/src/tools/ecode/filesystemlistener.cpp @@ -43,7 +43,8 @@ void FileSystemListener::handleFileAction( efsw::WatchID, const std::string& dir Log::debug( txt ); } - mFileSystemModel.get()->handleFileEvent( event ); + if ( mFileSystemModel ) + mFileSystemModel.get()->handleFileEvent( event ); if ( mDirTree ) mDirTree.get()->onChange( (ProjectDirectoryTree::Action)action, file, oldFilename ); diff --git a/src/tools/ecode/plugins/lsp/lspclientserver.cpp b/src/tools/ecode/plugins/lsp/lspclientserver.cpp index f8b71f4a8..5140350b9 100644 --- a/src/tools/ecode/plugins/lsp/lspclientserver.cpp +++ b/src/tools/ecode/plugins/lsp/lspclientserver.cpp @@ -834,7 +834,7 @@ void LSPClientServer::initialize() { { "hover", json{ { "contentFormat", { "plaintext", "markdown" } } } } }, }, { "window", json{ { "workDoneProgress", true } } }, - { "workspace", json{ { "workspaceFolders", true }, { "configuration", false } } }, + //{ "workspace", json{ { "workspaceFolders", true }, { "configuration", false } } }, { "general", json{ { "positionEncodings", json::array( { "utf-32" } ) } } } }; json params{ { "processId", Sys::getProcessID() },