Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #18

Merged
merged 83 commits into from
Nov 23, 2024
Merged

Dev #18

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
bf6d6a5
github action #29
yousefvand Nov 12, 2024
3e77555
github action #30
yousefvand Nov 12, 2024
0f421a6
github action #31
yousefvand Nov 12, 2024
610f0f0
github action #32
yousefvand Nov 12, 2024
42f66ef
github action #33
yousefvand Nov 12, 2024
29605b3
github action #34
yousefvand Nov 12, 2024
8b445f3
github action #35
yousefvand Nov 12, 2024
aaae8b8
github action #36
yousefvand Nov 12, 2024
0d858c4
github action #37
yousefvand Nov 12, 2024
f6dac47
github action #38
yousefvand Nov 12, 2024
ce45a46
github action #39
yousefvand Nov 12, 2024
162147e
github action #40
yousefvand Nov 12, 2024
f13c9a9
github action #41
yousefvand Nov 12, 2024
c9f7be8
github action #42
yousefvand Nov 13, 2024
971a301
gitub action #43
yousefvand Nov 13, 2024
40b535c
github action #44
yousefvand Nov 13, 2024
b4c98e4
github action #45
yousefvand Nov 13, 2024
b7b7150
github action #46
yousefvand Nov 13, 2024
c5c1f5f
github action #47
yousefvand Nov 13, 2024
f7af3e5
github action #48
yousefvand Nov 14, 2024
855d2b5
github action #49
yousefvand Nov 14, 2024
92b65c9
github action #50
yousefvand Nov 14, 2024
ec022d4
github action #51
yousefvand Nov 14, 2024
da6e710
github action #52
yousefvand Nov 14, 2024
deededd
github action #53
yousefvand Nov 14, 2024
f4f66be
github action #54
yousefvand Nov 15, 2024
c0eec14
github action #55
yousefvand Nov 15, 2024
dfbe1b6
github action #56
yousefvand Nov 15, 2024
061ccd4
github action#57
yousefvand Nov 16, 2024
85106da
github action #58
yousefvand Nov 16, 2024
acdf24a
github action #59
yousefvand Nov 16, 2024
7ae59ec
github action #60
yousefvand Nov 16, 2024
547634c
github action #61
yousefvand Nov 17, 2024
d547ef0
github action #62
yousefvand Nov 17, 2024
a1e8ace
github action #63
yousefvand Nov 17, 2024
e524a5c
v0.0.48
yousefvand Nov 17, 2024
5c1ceb4
github action #64
yousefvand Nov 18, 2024
9641f3b
github action #65
yousefvand Nov 18, 2024
fc86799
github action #66
yousefvand Nov 18, 2024
0d0f908
v0.0.49
yousefvand Nov 18, 2024
941ac22
github action #67
yousefvand Nov 19, 2024
d31ce9d
github action #68
yousefvand Nov 19, 2024
d0401e8
github action #69
yousefvand Nov 19, 2024
ad2c9c1
github action #70
yousefvand Nov 19, 2024
cd6193e
github action #71
yousefvand Nov 19, 2024
9655b65
github action #72
yousefvand Nov 19, 2024
1d2b451
github action #73
yousefvand Nov 19, 2024
e804fba
Find System (partially 3)
yousefvand Nov 19, 2024
c34f693
github action #74
yousefvand Nov 19, 2024
294844f
github action #75
yousefvand Nov 19, 2024
62e90fb
github action #76
yousefvand Nov 19, 2024
c404aef
v0.0.50
yousefvand Nov 20, 2024
5b39311
github action #77
yousefvand Nov 20, 2024
6debc22
github action #78
yousefvand Nov 20, 2024
61bb39e
github action #79
yousefvand Nov 20, 2024
71b5dd8
github action #80
yousefvand Nov 20, 2024
2fd3e6b
github action #81
yousefvand Nov 20, 2024
98261ea
github action #82
yousefvand Nov 20, 2024
6606a43
github action #83
yousefvand Nov 20, 2024
75aed59
github action #84
yousefvand Nov 20, 2024
bcf184a
github action #85
yousefvand Nov 20, 2024
0a73b58
github action #86
yousefvand Nov 20, 2024
a9dc549
github action #87
yousefvand Nov 20, 2024
d4f3a3e
github action #88
yousefvand Nov 20, 2024
3aa3881
github action #89
yousefvand Nov 21, 2024
ea1b572
github action #90
yousefvand Nov 21, 2024
58c4fab
github action #91
yousefvand Nov 21, 2024
10d41bf
github action #
yousefvand Nov 21, 2024
ed861c7
github action #93
yousefvand Nov 21, 2024
e396cc7
github action #94
yousefvand Nov 21, 2024
16fccd2
github action #95
yousefvand Nov 21, 2024
fdadff1
github action #96
yousefvand Nov 21, 2024
b3e5a17
github action #97
yousefvand Nov 22, 2024
22c4d00
github action #98
yousefvand Nov 22, 2024
15c4167
github action #99
yousefvand Nov 22, 2024
a3f0c7f
github action #100
yousefvand Nov 23, 2024
c2394bc
v0.0.52
yousefvand Nov 23, 2024
6534474
github action #101
yousefvand Nov 23, 2024
7b118e4
github action #102
yousefvand Nov 23, 2024
a6b405b
fix github action #102
yousefvand Nov 23, 2024
d72ef2a
v0.0.53
yousefvand Nov 23, 2024
ad8972a
Merge pull request #16 from yousefvand/dev
yousefvand Nov 23, 2024
0670101
Merge pull request #17 from yousefvand/main
yousefvand Nov 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 1 addition & 40 deletions .github/workflows/cmake-multi-platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
brew install ninja qt
echo "CMAKE_PREFIX_PATH=$(brew --prefix qt)" >> $GITHUB_ENV

### Windows Setup with Qt Installation
### Windows Setup
- name: Install dependencies (Windows)
if: matrix.os == 'windows-latest'
shell: powershell
Expand All @@ -55,43 +55,6 @@ jobs:
choco install ninja -y
choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System' -y

- name: Download and Install Qt (Windows)
if: matrix.os == 'windows-latest'
shell: powershell
run: |
$installer = "qt-unified-windows-x64-online.exe"
Invoke-WebRequest -Uri "https://download.qt.io/official_releases/online_installers/qt-unified-windows-x64-online.exe" -OutFile $installer -TimeoutSec 1200

# Install Qt in a non-interactive mode
Start-Process -FilePath $installer -ArgumentList `
'install', `
'--platform', 'minimal', `
'--accept-licenses', `
'--no-default-installations', `
'--root', 'C:\Qt' `
-NoNewWindow -Wait

# Verify the Qt installation by checking for installation folders
if (-Not (Test-Path "C:\Qt\6*")) {
throw "Qt installation failed!"
} else {
Write-Host "Qt installation verified"
}

- name: Set up MSVC environment (Windows)
if: matrix.os == 'windows-latest'
shell: cmd
run: |
FOR /F "tokens=*" %%i IN ('"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" ^
-latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath') DO SET VS_PATH=%%i
IF NOT DEFINED VS_PATH (
echo Visual Studio Build Tools not found! && exit /b 1
)
SET "VS_VARS_CMD=%VS_PATH%\VC\Auxiliary\Build\vcvars64.bat"
CALL "%VS_VARS_CMD%" || exit /b 1
where cl || (echo cl.exe not found in PATH && exit /b 1)

# Configure CMake
- name: Configure CMake
run: |
cmake -B "${{ github.workspace }}/build" \
Expand All @@ -101,11 +64,9 @@ jobs:
-G "Ninja" \
-S "${{ github.workspace }}"

# Build the project
- name: Build
run: cmake --build "${{ github.workspace }}/build" --config Release

# Run tests
- name: Test
working-directory: "${{ github.workspace }}/build"
run: ctest --output-on-failure --build-config Release
31 changes: 31 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,36 @@
# Change Log

## 0.0.53

- Implemented:
- Search Menu -> Find System revised


## 0.0.52

- Implemented:
- Search Menu -> Find System completed

## 0.0.51

- Implemented:
- Search Menu -> Find System (partially 4)

## 0.0.50

- Implemented:
- Search Menu -> Find System (partially 3)

## 0.0.49

- Implemented:
- Search Menu -> Find System (partially 2)

## 0.0.48

- Implemented:
- Search Menu -> Find System (partially)

## 0.0.47

- Implemented:
Expand Down
31 changes: 21 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ set(PROJECT_UI
src/indentation/indentationdialog.ui
src/systemfind/systemfinddialog.ui
src/systemreplace/systemreplacedialog.ui
src/systemsearchresultdialog.ui
)

set(PROJECT_SOURCES
Expand Down Expand Up @@ -72,23 +73,33 @@ set(PROJECT_SOURCES
src/indentation/indentationdialog.h
src/indentation/indentationmanager.cpp
src/indentation/indentationmanager.h
src/find/finddialog.cpp
src/find/finddialog.h
src/replace/replacedialog.cpp
src/replace/replacedialog.h
src/systemfind/systemfinddialog.cpp
src/systemfind/systemfinddialog.h
src/systemreplace/systemreplacedialog.cpp
src/systemreplace/systemreplacedialog.h
src/replace/replace.cpp
src/replace/replace.h
src/find/find.cpp
src/find/find.h
src/search/search.cpp
src/search/search.h


src/search/searchoptions.h
src/search/filesearchworker.cpp
src/search/filesearchworker.h
src/find/finddialog.cpp
src/find/finddialog.h
src/find/find.cpp
src/find/find.h
src/systemfind/systemfind.cpp
src/systemfind/systemfind.h
src/systemfind/systemfinddialog.cpp
src/systemfind/systemfinddialog.h
src/systemfind/richtextdelegate.cpp
src/systemfind/richtextdelegate.h
src/systemreplace/systemreplacedialog.cpp
src/systemreplace/systemreplacedialog.h
src/systemreplace/systemreplace.cpp
src/systemreplace/systemreplace.h
src/systemsearchresultdialog.cpp
src/systemsearchresultdialog.h
src/systemtextdelegate.cpp
src/systemtextdelegate.h
${PROJECT_UI}
)

Expand Down
22 changes: 11 additions & 11 deletions CMakeLists.txt.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 14.0.2, 2024-11-10T04:16:59. -->
<!-- Written by QtCreator 14.0.2, 2024-11-23T23:54:00. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
Expand Down Expand Up @@ -102,14 +102,14 @@
<value type="int" key="CMake.Configure.BaseEnvironment">2</value>
<value type="bool" key="CMake.Configure.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="CMake.Configure.UserEnvironmentChanges"/>
<value type="QString" key="CMake.Initial.Parameters">-DCMAKE_CXX_COMPILER:FILEPATH=%{Compiler:Executable:Cxx}
<value type="QString" key="CMake.Initial.Parameters">-DCMAKE_C_COMPILER:FILEPATH=%{Compiler:Executable:C}
-DCMAKE_BUILD_TYPE:STRING=Debug
-DCMAKE_CXX_FLAGS_INIT:STRING=%{Qt:QML_DEBUG_FLAG}
-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=%{BuildConfig:BuildDirectory:NativeFilePath}/.qtc/package-manager/auto-setup.cmake
-DCMAKE_PREFIX_PATH:PATH=%{Qt:QT_INSTALL_PREFIX}
-DCMAKE_C_COMPILER:FILEPATH=%{Compiler:Executable:C}
-DQT_QMAKE_EXECUTABLE:FILEPATH=%{Qt:qmakeExecutable}
-DCMAKE_GENERATOR:STRING=Ninja
-DCMAKE_BUILD_TYPE:STRING=Debug</value>
-DCMAKE_PREFIX_PATH:PATH=%{Qt:QT_INSTALL_PREFIX}
-DCMAKE_CXX_COMPILER:FILEPATH=%{Compiler:Executable:Cxx}
-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=%{BuildConfig:BuildDirectory:NativeFilePath}/.qtc/package-manager/auto-setup.cmake</value>
<value type="QString" key="CMake.Source.Directory">/data/Code/Qt/Notepad--</value>
<value type="int" key="EnableQmlDebugging">0</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/data/Code/Qt/Notepad--/build/Desktop-Debug</value>
Expand Down Expand Up @@ -160,14 +160,14 @@
<value type="int" key="CMake.Configure.BaseEnvironment">2</value>
<value type="bool" key="CMake.Configure.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="CMake.Configure.UserEnvironmentChanges"/>
<value type="QString" key="CMake.Initial.Parameters">-DCMAKE_CXX_COMPILER:FILEPATH=%{Compiler:Executable:Cxx}
<value type="QString" key="CMake.Initial.Parameters">-DCMAKE_C_COMPILER:FILEPATH=%{Compiler:Executable:C}
-DCMAKE_BUILD_TYPE:STRING=Release
-DCMAKE_CXX_FLAGS_INIT:STRING=%{Qt:QML_DEBUG_FLAG}
-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=%{BuildConfig:BuildDirectory:NativeFilePath}/.qtc/package-manager/auto-setup.cmake
-DCMAKE_PREFIX_PATH:PATH=%{Qt:QT_INSTALL_PREFIX}
-DCMAKE_C_COMPILER:FILEPATH=%{Compiler:Executable:C}
-DQT_QMAKE_EXECUTABLE:FILEPATH=%{Qt:qmakeExecutable}
-DCMAKE_GENERATOR:STRING=Ninja
-DCMAKE_BUILD_TYPE:STRING=Release</value>
-DCMAKE_PREFIX_PATH:PATH=%{Qt:QT_INSTALL_PREFIX}
-DCMAKE_CXX_COMPILER:FILEPATH=%{Compiler:Executable:Cxx}
-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=%{BuildConfig:BuildDirectory:NativeFilePath}/.qtc/package-manager/auto-setup.cmake</value>
<value type="QString" key="CMake.Source.Directory">/data/Code/Qt/Notepad--</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/data/Code/Qt/Notepad--/build/Desktop-Release</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
Expand Down
22 changes: 22 additions & 0 deletions assets/count_text_files.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

# Check if a path is provided
if [ -z "$1" ]; then
echo "Usage: $0 <directory-path>"
exit 1
fi

# Assign the provided path to a variable
DIR="$1"

# Check if the provided path is a valid directory
if [ ! -d "$DIR" ]; then
echo "Error: $DIR is not a valid directory."
exit 1
fi

# Find files, check MIME type, and count text files
total_text_files=$(find "$DIR" -type f -exec file --mime-type {} + | grep -c "text/")

# Output the result
echo "Total text files in '$DIR' and its subdirectories: $total_text_files"
57 changes: 55 additions & 2 deletions src/codeeditor.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "codeeditor.h"
#include <QPainter>
#include <QTextBlock>
#include <QScrollBar>
#include "helpers.h"

CodeEditor::CodeEditor(QWidget *parent)
Expand Down Expand Up @@ -153,10 +154,62 @@ void CodeEditor::lineNumberAreaPaintEvent(QPaintEvent *event) {
}

void CodeEditor::applyIndentation(bool useTabs, int indentationWidth) {
// TODO: Implement indentation
qDebug() << "Indentation. Use Tabs: " << useTabs << ". Indentation width: " << indentationWidth;
QTextCursor cursor = textCursor();
QString indentation = useTabs ? "\t" : QString(indentationWidth, ' ');
cursor.insertText(indentation);
}

QTabWidget* CodeEditor::DocumentsTab() {
return m_documentsTab;
}

void CodeEditor::highlightAllOccurrences(const QString& keyword) {
QList<QTextEdit::ExtraSelection> extraSelections;

QTextCursor cursor(document());
QTextCursor highlightCursor(document());
QTextCharFormat highlightFormat;
highlightFormat.setBackground(Qt::cyan);

while (!cursor.isNull() && !cursor.atEnd()) {
cursor = document()->find(keyword, cursor);
if (!cursor.isNull()) {
QTextEdit::ExtraSelection selection;
selection.cursor = cursor;
selection.format = highlightFormat;
extraSelections.append(selection);
}
}

setExtraSelections(extraSelections);
}

void CodeEditor::goToLineInText(int lineNumber) {
if (lineNumber < 1 || lineNumber > document()->blockCount()) {
qWarning() << "Line number: " << lineNumber << ". Line number is out of range.";
return;
}

QTextCursor cursor(document()->findBlockByNumber(lineNumber - 1));
setTextCursor(cursor);
centerCursor(); // Ensure the cursor is centered in the view

qDebug() << "Moved to line:" << lineNumber;

// Log current cursor position
qDebug() << "Cursor position after move:" << textCursor().position();
}

void CodeEditor::gotoLineInEditor(int lineNumber) {
// Ensure the line number is within the valid range
if (lineNumber > 0 && lineNumber <= blockCount()) {
QTextCursor cursor = textCursor();
cursor.movePosition(QTextCursor::Start);
cursor.movePosition(QTextCursor::Down, QTextCursor::MoveAnchor, lineNumber - 1);
setTextCursor(cursor);
centerCursor();
} else {
qWarning() << "Invalid Line Number: " << lineNumber << " .The specified line is out of range.";
}
}

5 changes: 4 additions & 1 deletion src/codeeditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,15 @@ class CodeEditor : public QPlainTextEdit {
void highlightCurrentLine();
void applyIndentation(bool useTabs, int indentationWidth);
QTabWidget* DocumentsTab();
void highlightAllOccurrences(const QString& keyword);
void goToLineInText(int lineNumber);
void gotoLineInEditor(int lineNumber);

protected:
void resizeEvent(QResizeEvent *event) override;

signals:
void textChanged();
void textChanged(); // FIXME: Remove this line.

private slots:
void updateLineNumberAreaWidth(int newBlockCount);
Expand Down
Loading
Loading