Store project style settings in VCS.

I'm sick of getting my settings stomped on every god damn time I open CLion.
This commit is contained in:
Kyle Isom 2023-10-11 19:25:24 -07:00
parent 187ff6cb01
commit fd6e0c6899
12 changed files with 148 additions and 71 deletions

2
.gitignore vendored
View File

@ -1,7 +1,7 @@
.cmake
.idea
.trunk
.vc
.vs
.vscode
*.a

8
.idea/.gitignore vendored Normal file
View File

@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View File

@ -0,0 +1,29 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<Objective-C>
<option name="FUNCTION_BRACE_PLACEMENT" value="2" />
</Objective-C>
<files>
<extensions>
<pair source="cc" header="h" fileNamingConvention="PASCAL_CASE" />
<pair source="c" header="h" fileNamingConvention="NONE" />
<pair source="cu" header="cuh" fileNamingConvention="NONE" />
<pair source="ixx" header="" fileNamingConvention="NONE" />
<pair source="mxx" header="" fileNamingConvention="NONE" />
<pair source="cppm" header="" fileNamingConvention="NONE" />
<pair source="ccm" header="" fileNamingConvention="NONE" />
<pair source="cxxm" header="" fileNamingConvention="NONE" />
<pair source="c++m" header="" fileNamingConvention="NONE" />
</extensions>
</files>
<codeStyleSettings language="ObjectiveC">
<option name="ALIGN_GROUP_FIELD_DECLARATIONS" value="true" />
<indentOptions>
<option name="INDENT_SIZE" value="8" />
<option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="TAB_SIZE" value="8" />
<option name="USE_TAB_CHARACTER" value="true" />
</indentOptions>
</codeStyleSettings>
</code_scheme>
</component>

View File

@ -0,0 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</state>
</component>

2
.idea/kge.iml Normal file
View File

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<module classpath="CMake" type="CPP_MODULE" version="4" />

9
.idea/misc.xml Normal file
View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
<component name="CidrRootsConfiguration">
<libraryRoots>
<file path="$PROJECT_DIR$/ext" />
</libraryRoots>
</component>
</project>

8
.idea/modules.xml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/kge.iml" filepath="$PROJECT_DIR$/.idea/kge.iml" />
</modules>
</component>
</project>

6
.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View File

@ -44,20 +44,20 @@ anonymousName()
Buffer::Buffer()
: name(anonymousName()), path(std::nullopt), file(std::nullopt)
: name(anonymousName())
{
}
Buffer::Buffer(std::string fName)
: name(std::move(fName)), path(std::nullopt), file(std::nullopt)
: name(std::move(fName))
{
}
Buffer::Buffer(std::string fName, std::string fPath)
: name(std::move(fName)), path(std::move(fPath)), file(std::nullopt)
: name(std::move(fName)), path(std::move(fPath))
{
if (this->path) {
this->file = OptFile(File(this->path.value()));

View File

@ -9,10 +9,12 @@
#define KEPP_FRAME_H
#include <cstdint>
#include <vector>
#include "Defs.h"
#include "File.h"
#include "Cursor.h"
typedef std::vector<std::vector<uint8_t>> BufferContents;
@ -50,6 +52,7 @@ private:
std::string name;
OptString path;
OptFile file;
Cursor cursor;
BufferContents contents;
};

View File

@ -1,9 +1,9 @@
cmake_minimum_required(VERSION 3.22)
project(kge
DESCRIPTION "kyle's editor"
LANGUAGES CXX
VERSION 0.0.1)
DESCRIPTION "kyle's editor"
LANGUAGES CXX
VERSION 0.0.1)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_VERBOSE_MAKEFILES TRUE)
@ -20,98 +20,104 @@ string(TIMESTAMP TODAY "%Y%m%d")
set(BUILD_GUI OFF CACHE BOOL "Disable building the graphical version.")
if (CMAKE_HOST_UNIX)
message(STATUS "Build system is POSIX.")
endif()
message(STATUS "Build system is POSIX.")
else ()
message(STATUS "Build system is NOT POSIX.")
endif ()
if(MSVC)
add_compile_options("/W4" "$<$<CONFIG:RELEASE>:/O2>")
else()
add_compile_options(
"-Wall"
"-Wextra"
"-Werror"
"-static"
"$<$<CONFIG:DEBUG>:-g>"
"$<$<CONFIG:RELEASE>:-O2>")
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
add_compile_options("-stdlib=libc++")
else()
# nothing special for gcc at the moment
endif()
endif()
if (MSVC)
add_compile_options("/W4" "$<$<CONFIG:RELEASE>:/O2>")
else ()
add_compile_options(
"-Wall"
"-Wextra"
"-Werror"
"-static"
"$<$<CONFIG:DEBUG>:-g>"
"$<$<CONFIG:RELEASE>:-O2>")
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
add_compile_options("-stdlib=libc++")
else ()
# nothing special for gcc at the moment
endif ()
endif ()
add_compile_definitions(KGE_PLATFORM=${CMAKE_HOST_SYSTEM_NAME})
add_compile_definitions(KGE_VERSION=${PROJECT_VERSION})
message(STATUS "Build system: ${CMAKE_HOST_SYSTEM_NAME}")
if(${BUILD_GUI})
include(cmake/imgui.cmake)
endif()
if (${BUILD_GUI})
include(cmake/imgui.cmake)
endif ()
#####################
### BUILD TARGETS ###
#####################
set(HEADER_FILES
Defs.h
Buffer.h
File.h
Cursor.h
Defs.h
Buffer.h
File.h
Cursor.h
)
set(SOURCE_FILES
Defs.cc
Buffer.cc
File.cc
Cursor.cc
Defs.cc
Buffer.cc
File.cc
Cursor.cc
)
add_executable(ke main.cc ${SOURCE_FILES} ${HEADER_FILES})
add_custom_target(manpages)
configure_file(docs/ke.md ke.1.scdoc @ONLY)
add_custom_command(TARGET manpages COMMAND scdoc < ke.1.scdoc > ke.1
OUTPUTS ${CMAKE_CURRENT_BINARY_DIR}/ke.1)
add_dependencies(ke manpages)
if (CMAKE_HOST_UNIX)
add_custom_target(manpages)
configure_file(docs/ke.md ke.1.scdoc @ONLY)
add_custom_command(TARGET manpages COMMAND scdoc < ke.1.scdoc > ke.1
OUTPUTS ${CMAKE_CURRENT_BINARY_DIR}/ke.1)
add_dependencies(ke manpages)
endif ()
if(${BUILD_GUI})
configure_file(resources/kge.desktop.in kge.desktop @ONLY)
add_executable(kge gmain.cc ${SOURCE_FILES} ${HEADER_FILES})
target_link_libraries(kge imgui)
add_dependencies(kge ke)
if (${BUILD_GUI})
configure_file(resources/kge.desktop.in kge.desktop @ONLY)
add_executable(kge gmain.cc ${SOURCE_FILES} ${HEADER_FILES})
target_link_libraries(kge imgui)
add_dependencies(kge ke)
configure_file(docs/kge.md kge.1.scdoc @ONLY)
add_custom_command(TARGET manpages COMMAND scdoc < kge.1.scdoc > kge.1
OUTPUTS ${CMAKE_CURRENT_BINARY_DIR}/kge.1)
if (CMAKE_HOST_UNIX)
configure_file(docs/kge.md kge.1.scdoc @ONLY)
add_custom_command(TARGET manpages COMMAND scdoc < kge.1.scdoc > kge.1
OUTPUTS ${CMAKE_CURRENT_BINARY_DIR}/kge.1)
add_dependencies(kge manpages)
endif()
add_dependencies(kge manpages)
endif ()
endif ()
#######################
### INSTALL TARGETS ###
#######################
install(TARGETS ke
DESTINATION bin
COMPONENT nox)
DESTINATION bin
COMPONENT nox)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ke.1
DESTINATION share/man/man1
COMPONENT nox)
DESTINATION share/man/man1
COMPONENT nox)
if(${BUILD_GUI})
install(TARGETS kge
DESTINATION bin
COMPONENT nox
COMPONENT gui)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/kge.desktop
DESTINATION share/applications
COMPONENT gui)
install(FILES resources/kge.png
DESTINATION share/${PROJECT_NAME}
COMPONENT gui)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/kge.1
DESTINATION share/man/man1
COMPONENT gui)
endif()
if (${BUILD_GUI})
install(TARGETS kge
DESTINATION bin
COMPONENT nox
COMPONENT gui)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/kge.desktop
DESTINATION share/applications
COMPONENT gui)
install(FILES resources/kge.png
DESTINATION share/${PROJECT_NAME}
COMPONENT gui)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/kge.1
DESTINATION share/man/man1
COMPONENT gui)
endif ()
include(cmake/packaging.cmake)

View File

@ -32,7 +32,8 @@
/// Cursors represent a position in a Buffer.
class Cursor {
public:
Cursor(size_t _x, size_t _y) : x(_x), y(_y) {};
Cursor() : x(0), y(0) {}
Cursor(size_t _x, size_t _y) : x(_x), y(_y) {}
size_t X() const { return this->x; }
size_t Y() const { return this->y; }