MCPcopy Create free account
hub / github.com/SpartanJ/eepp / createTerminalInSplitter

Method createTerminalInSplitter

src/tools/ecode/terminalmanager.cpp:11–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9TerminalManager::TerminalManager( App* app ) : mApp( app ) {}
10
11UITerminal* TerminalManager::createTerminalInSplitter(
12 const std::string& workingDir, std::string program, std::vector<std::string> args,
13 const std::unordered_map<std::string, std::string>& env, bool fallback, bool keepAlive ) {
14#if EE_PLATFORM == EE_PLATFORM_WIN
15 std::string os = Sys::getOSName( true );
16 if ( !LuaPattern::hasMatches( os, "Windows 1%d"sv ) &&
17 !LuaPattern::hasMatches( os, "Windows Server 201[69]"sv ) &&
18 !LuaPattern::hasMatches( os, "Windows Server 202%d"sv ) ) {
19 if ( fallback )
20 displayError( workingDir );
21 return nullptr;
22 }
23#endif
24
25 UITerminal* term = nullptr;
26 auto splitter = mApp->getSplitter();
27 auto& config = mApp->getConfig();
28
29 if ( config.term.newTerminalOrientation == NewTerminalOrientation::StatusBarPanel &&
30 mApp->getStatusTerminalController() ) {
31 mApp->getStatusTerminalController()->show();
32 mApp->getStatusTerminalController()->createTerminal();
33 } else if ( splitter && splitter->hasSplit() ) {
34 if ( splitter->getTabWidgets().size() == 2 ) {
35 UIOrientation orientation = splitter->getMainSplitOrientation();
36 if ( config.term.newTerminalOrientation == NewTerminalOrientation::Vertical &&
37 orientation == UIOrientation::Horizontal ) {
38 term = createNewTerminal( "", splitter->getTabWidgets()[1], workingDir, program,
39 args, env, fallback, keepAlive );
40 } else if ( config.term.newTerminalOrientation == NewTerminalOrientation::Horizontal &&
41 orientation == UIOrientation::Vertical ) {
42 term = createNewTerminal( "", splitter->getTabWidgets()[1], workingDir, program,
43 args, env, fallback, keepAlive );
44 } else {
45 term = createNewTerminal( "", nullptr, workingDir, program, args );
46 }
47 } else {
48 term = createNewTerminal( "", nullptr, workingDir, program, args );
49 }
50 } else if ( splitter ) {
51 switch ( config.term.newTerminalOrientation ) {
52 case NewTerminalOrientation::Vertical: {
53 auto cwd = workingDir.empty() ? getSelectedWorkingDir() : workingDir;
54 splitter->split( SplitDirection::Right, splitter->getCurWidget(), false );
55 term =
56 createNewTerminal( "", nullptr, cwd, program, args, env, fallback, keepAlive );
57 break;
58 }
59 case NewTerminalOrientation::Horizontal: {
60 auto cwd = workingDir.empty() ? getSelectedWorkingDir() : workingDir;
61 splitter->split( SplitDirection::Bottom, splitter->getCurWidget(), false );
62 term =
63 createNewTerminal( "", nullptr, cwd, program, args, env, fallback, keepAlive );
64 break;
65 }
66 case NewTerminalOrientation::Same: {
67 term =
68 createNewTerminal( "", nullptr, "", program, args, env, fallback, keepAlive );

Callers 3

runConfigMethod · 0.80
runMethod · 0.80

Calls 11

getConfigMethod · 0.80
createTerminalMethod · 0.80
hasSplitMethod · 0.80
getCurWidgetMethod · 0.80
getSplitterMethod · 0.45
showMethod · 0.45
sizeMethod · 0.45
emptyMethod · 0.45
splitMethod · 0.45

Tested by

no test coverage detected