Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
SpartanJ committed Feb 8, 2023
1 parent b98e438 commit 4fa35ff
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 13 deletions.
11 changes: 6 additions & 5 deletions include/eepp/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,12 @@

#ifndef EE_ENDIAN

#if defined( __386__ ) || defined( i386 ) || defined( __i386__ ) || defined( __X86 ) || \
defined( _M_IX86 ) || defined( _M_X64 ) || defined( __x86_64__ ) || defined( alpha ) || \
defined( __alpha ) || defined( __alpha__ ) || defined( _M_ALPHA ) || defined( ARM ) || \
defined( _ARM ) || defined( __arm__ ) || defined( WIN32 ) || defined( _WIN32 ) || \
defined( __WIN32__ ) || defined( _WIN32_WCE ) || defined( __NT__ ) || defined( __MIPSEL__ )
#if defined( __386__ ) || defined( i386 ) || defined( __i386__ ) || defined( __X86 ) || \
defined( _M_IX86 ) || defined( _M_X64 ) || defined( __x86_64__ ) || defined( alpha ) || \
defined( __alpha ) || defined( __alpha__ ) || defined( _M_ALPHA ) || defined( ARM ) || \
defined( _ARM ) || defined( __arm__ ) || defined( WIN32 ) || defined( _WIN32 ) || \
defined( __WIN32__ ) || defined( _WIN32_WCE ) || defined( __NT__ ) || defined( __MIPSEL__ ) || \
defined( EE_ARM )
#define EE_ENDIAN EE_LITTLE_ENDIAN
#else
#define EE_ENDIAN EE_BIG_ENDIAN
Expand Down
6 changes: 4 additions & 2 deletions include/eepp/ui/doc/textdocument.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,11 @@ class EE_API TextDocument {

bool isNonWord( String::StringBaseType ch ) const;

bool hasFilepath();
bool hasFilepath() const;

bool isEmpty();
bool isEmpty() const;

bool isUntitledEmpty() const;

void reset();

Expand Down
8 changes: 7 additions & 1 deletion include/eepp/ui/tools/uicodeeditorsplitter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,13 @@ class EE_API UICodeEditorSplitter {
t.setCommand( "close-tab", [&] { tryTabClose( mCurWidget ); } );
t.setCommand( "create-new", [&] {
auto d = createCodeEditorInTabWidget( tabWidgetFromWidget( mCurWidget ) );
d.first->getTabWidget()->setTabSelected( d.first );
if ( d.first != nullptr && d.second != nullptr ) {
d.first->getTabWidget()->setTabSelected( d.first );
} else if ( !mTabWidgets.empty() ) {
d = createCodeEditorInTabWidget( mTabWidgets[0] );
}
if ( d.first == nullptr || d.second == nullptr )
Log::error( "Couldn't createCodeEditorInTabWidget in create-new command" );
} );
t.setCommand( "next-tab", [&] {
UITabWidget* tabWidget = tabWidgetFromWidget( mCurWidget );
Expand Down
2 changes: 1 addition & 1 deletion premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ end

function generate_os_links()
if os.istarget("linux") then
multiple_insert( os_links, { "rt", "pthread", "GL", "Xcursor" } )
multiple_insert( os_links, { "rt", "pthread", "GL" } )

if _OPTIONS["with-static-eepp"] then
table.insert( os_links, "dl" )
Expand Down
2 changes: 1 addition & 1 deletion projects/linux/ee.creator.user
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 8.0.2, 2023-01-21T03:27:59. -->
<!-- Written by QtCreator 8.0.2, 2023-02-08T16:38:47. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
Expand Down
8 changes: 6 additions & 2 deletions src/eepp/ui/doc/textdocument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,18 @@ TextDocument::~TextDocument() {
FileSystem::fileRemove( mFilePath );
}

bool TextDocument::hasFilepath() {
bool TextDocument::hasFilepath() const {
return mDefaultFileName != mFilePath;
}

bool TextDocument::isEmpty() {
bool TextDocument::isEmpty() const {
return linesCount() == 1 && line( 0 ).size() == 1;
}

bool TextDocument::isUntitledEmpty() const {
return isEmpty() && !hasFilepath();
}

void TextDocument::reset() {
mFilePath = mDefaultFileName;
mFileRealPath = FileInfo();
Expand Down
5 changes: 4 additions & 1 deletion src/eepp/ui/tools/uicodeeditorsplitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -835,8 +835,11 @@ void UICodeEditorSplitter::closeTab( UIWidget* widget ) {
if ( tabWidget ) {
if ( !( editor->getDocument().isEmpty() &&
!tabWidget->getParent()->isType( UI_TYPE_SPLITTER ) &&
tabWidget->getTabCount() == 1 ) ) {
tabWidget->getTabCount() == 1 ) ||
!editor->getDocument().isUntitledEmpty() ) {
tabWidget->removeTab( (UITab*)editor->getData() );
} else {
return;
}
}
} else {
Expand Down

0 comments on commit 4fa35ff

Please sign in to comment.