Skip to content

Commit

Permalink
v1.8.5
Browse files Browse the repository at this point in the history
  • Loading branch information
deadlyjack committed Jul 8, 2023
1 parent e2869a5 commit 73bee72
Show file tree
Hide file tree
Showing 30 changed files with 471 additions and 162 deletions.
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"antlr",
"anyscript",
"applescript",
"Asuming",
"audiotrack",
"autocorrect",
"autohotkey",
Expand Down
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Change Log

## [1.8.5] - Build 293
## [1.8.5] - Build 294

- New
- [x] **Touch handling**
- Prevent accidental touch when tapping tear drop.
- [x] **Color Preview**
- You can now see color preview in css, scss, less, stylus and sass codes.
- No need to select the whole color.
Expand Down
2 changes: 1 addition & 1 deletion config.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8' ?>
<widget id="com.foxdebug.acode" android-versionCode="293" version="1.8.5"
<widget id="com.foxdebug.acode" android-versionCode="294" version="1.8.5"
xmlns="http://www.w3.org/ns/widgets"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:cdv="http://cordova.apache.org/ns/1.0">
Expand Down
60 changes: 40 additions & 20 deletions fastlane/metadata/android/en-US/full_description.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,40 @@
A powerful <i>code editor<i> for android. Edit like a pro.

<b>Why Acode?<b>
<ul>
<li>Edit remote files (FTP/Github).<li>
<li>Edit files from your internal/external storage<li>.
<li>Supports maximum number of lines.<li>
<li>Supports syntax highlighting for 100+ programming languages.<li>
<li>Manage you files and folder very easily.<li>
<li>Run or preview you web applications.<li>
<li>Preview includes inbuilt interactive js console.<li>
<li>Keyboard shortcuts.<li>
<li>Customizable.<li>
<li>Open any file with any application.<li>
<li>Updated frequenlty.<li>
<li>Fast bugs fixes.<li>
<li>And it is open source.<li>
<ul>

FAQs: https://acode.foxdebug.com/faqs
Welcome to Acode!

A powerful, lightweight code editor, and web IDE for Android. Now enhanced with cutting-edge features and updates to transform your coding experience.

What's New?

Step into the future of coding with our innovative Plugin System. This brand new feature supports a wide range of plugins, boosting the functionality of Acode to meet all your development needs. With over 30 plugins already available in the Plugin Store, the possibilities are endless.

Latest Updates Include:

- Enhanced Ace Editor: Now updated to version 1.22.0 for more efficient editing.
- Search in All Files: Our beta feature lets you search and replace text in all files within your opened projects.
- Customizable Quick Tools: Personalize your quick tools to enhance your workflow.
- Fast File Listing in Find Files (Ctrl + P): Acode now loads and caches files at startup, leading to faster file listing.
- Ctrl Key Functionality: Take advantage of keyboard shortcuts for actions such as save (Ctrl+S) and open command palette (Ctrl+Shift+P).

Why Choose Acode?

Acode lets you build and run websites directly within your browser, debug with ease using the integrated console, and edit a wide range of source files - from Python and CSS to Java, JavaScript, Dart, and more.

Key Features:

- Universal File Editor: Edit any file directly from your device.
- GitHub Integration: Seamlessly sync your projects with GitHub.
- FTP/SFTP Support: Manage your files efficiently with FTP/SFTP.
- Extensive Syntax Highlighting: Supports over 100 programming languages.
- Personalized Themes: Choose from dozens of unique themes to match your style.
- User-Friendly Interface: Navigate with ease through our intuitive design.
- In-App Preview: Instantly view your HTML/MarkDown files within the app.
- Interactive JavaScript Console: Debug JavaScript code right from the console.
- In-App File Browser: Access your files directly within Acode.
- Open Source: Benefit from our transparent and community-driven project.
- High Performance: Supports files with over 50,000 lines, ensuring smooth workflow.
- Multi-File Support: Work on multiple files simultaneously for productive multitasking.
- Customizable Interface: Adapt Acode to your personal coding style.
- Keyboard Shortcuts: Speed up your coding with handy shortcuts.
- File Recovery: Never lose your work with our reliable file recovery feature.
- File Management: Keep your projects organized with effective file management.

Start your streamlined coding journey with Acode today. Join our ever-growing community of developers and experience the difference for yourself!
Binary file modified fastlane/metadata/android/en-US/images/phoneScreenshots/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified fastlane/metadata/android/en-US/images/phoneScreenshots/2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified fastlane/metadata/android/en-US/images/phoneScreenshots/3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified fastlane/metadata/android/en-US/images/phoneScreenshots/4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified fastlane/metadata/android/en-US/images/phoneScreenshots/5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified fastlane/metadata/android/en-US/images/phoneScreenshots/6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified fastlane/metadata/android/en-US/images/phoneScreenshots/7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified fastlane/metadata/android/en-US/images/phoneScreenshots/8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "com.foxdebug.acode",
"displayName": "Acode",
"version": "1.8.4",
"version": "1.8.5",
"description": "Acode is a code editor for android",
"main": "index.js",
"scripts": {
Expand Down
49 changes: 41 additions & 8 deletions src/ace/colorView.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,44 @@ import helpers from 'utils/helpers';
import { Irid } from 'irid';
import { HEX, HSL, HSLA, RGB, RGBA } from 'utils/color';

const COLORPICKER_TOKEN_CLASS = '.ace_numeric,.ace_color';
const COLORPICKER_TOKEN_CLASS = '.ace_color';
const changedRules = [];

let editor = null;

/**
* Initialize color view
* @param {AceAjax.Editor} e Editor instance
* @param {boolean} [force=false] Force update color view
*/
export default function initColorView(e) {
export default function initColorView(e, force = false) {
editor = e;
const { renderer } = editor;

editor.on('changeMode', onChangeMode);
renderer.on('afterRender', afterRender);

if (force) {
const { files } = editorManager;

if (Array.isArray(files)) {
files.forEach(file => {
if (file.session) {
file.session._addedColorRule = false;
}
});
}

onChangeMode();
}
}

export function deactivateColorView() {
const { renderer } = editor;

changedRules.forEach((rule) => rule.shift());
changedRules.length = 0;
forceRender();
forceTokenizer();

editor.off('changeMode', onChangeMode);
renderer.off('afterRender', afterRender);
Expand Down Expand Up @@ -82,25 +97,43 @@ function onChangeMode() {

if (!forceUpdate) return;

forceRender();
forceTokenizer();
}

function afterRender() {
const { session, renderer } = editor;
const { content } = renderer;
let classes = COLORPICKER_TOKEN_CLASS;

// if session is css, scss, less, sass, stylus, or html (with css mode), continue

if (!sessionSupportsColor(session)) {
const mode = sessionSupportsColor(session);
if (!mode) {
return;
}

content.getAll(COLORPICKER_TOKEN_CLASS).forEach(( /**@type {HTMLElement} */ el) => {
if (mode === 'scss') {
classes += ',.ace_function';
}

content.getAll(COLORPICKER_TOKEN_CLASS).forEach(( /**@type {HTMLElement} */ el, i, els) => {
let content = el.textContent;
const previousContent = els[i - 1]?.textContent;
const nextContent = els[i + 1]?.textContent;
const multiLinePrev = previousContent + content;
const multiLineNext = content + nextContent;

if (el.dataset.modified === 'true') return;

if (!(helpers.isValidColor(content) || el.classList.contains('ace_color'))) return;
if (!helpers.isValidColor(content)) {
if (helpers.isValidColor(multiLinePrev)) {
content = multiLinePrev;
} else if (helpers.isValidColor(multiLineNext)) {
content = multiLineNext;
} else {
return;
}
}

try {
const brightness = Irid(content).lightness();
Expand All @@ -114,7 +147,7 @@ function afterRender() {
});
}

function forceRender() {
function forceTokenizer() {
const { session } = editor;
// force recreation of tokenizer
session.$mode.$tokenizer = null;
Expand Down
2 changes: 1 addition & 1 deletion src/ace/modelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class Mode {
re = "^.*\\.(" + extensions + ")$";
}

this.extRe = new RegExp(re, "gi");
this.extRe = new RegExp(re, "i");
}

supportsFile(filename) {
Expand Down
76 changes: 56 additions & 20 deletions src/ace/touchHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import constants from 'lib/constants';
import selectionMenu from 'lib/selectionMenu';
import appSettings from 'lib/settings';
import { key } from 'handlers/quickTools';
import { getColorRange } from 'utils/color';

/**
* Handler for touch events
Expand Down Expand Up @@ -102,23 +103,12 @@ export default function addTouchListeners(editor, minimal, onclick) {
let teardropMoveTimeout; // teardrop handler
let forceCursorMode = false; // force to show cursor
let $activeTeardrop; // active teardrop
let timeTouchStart; // time of touch start
let touchEnded = true; // true if touch ended

$el.addEventListener('touchstart', touchStart, config, true);
scroller.addEventListener('contextmenu', contextmenu, config);

editor.on('change', onupdate);
editor.on('fold', onfold);
editor.on('scroll', onscroll);
editor.on('changeSession', onchangesession);
editor.on('select-word', selectionMode.bind({}, $end));
editor.on('scroll-intoview', () => {
if (selectionActive) {
selectionMode($end);
} else {
cursorMode();
}
});

editor.setSelection = (value) => {
selectionActive = value;
};
Expand All @@ -128,6 +118,19 @@ export default function addTouchListeners(editor, minimal, onclick) {
};

if (!minimal) {
editor.on('change', onupdate);
editor.on('changeSession', onchangesession);
editor.on('scroll', onscroll);
editor.on('fold', onfold);
editor.on('select-word', selectionMode.bind({}, $end));
editor.on('scroll-intoview', () => {
if (selectionActive) {
selectionMode($end);
} else {
cursorMode();
}
});

appSettings.on('update:diagonalScrolling', (value) => {
diagonalScrolling = value;
});
Expand Down Expand Up @@ -182,6 +185,7 @@ export default function addTouchListeners(editor, minimal, onclick) {
return;
}

touchEnded = false;
lastX = clientX;
lastY = clientY;
moveY = 0;
Expand Down Expand Up @@ -257,6 +261,7 @@ export default function addTouchListeners(editor, minimal, onclick) {
// because select word and select line misbehave without
// preventDefault
removeListeners();
touchEnded = true;

const { clientX, clientY } = e.changedTouches[0];

Expand Down Expand Up @@ -296,6 +301,11 @@ export default function addTouchListeners(editor, minimal, onclick) {
}

if (mode === 'scroll') {
if (!moveX && !moveY) {
onscrollend();
return;
}

scrollAnimation(moveX, moveY);
return;
}
Expand Down Expand Up @@ -394,7 +404,7 @@ export default function addTouchListeners(editor, minimal, onclick) {
*/
function select() {
removeListeners();
const range = editor.selection.getWordRange();
const range = getColorRange() || editor.selection.getWordRange();
if (!range || range?.isEmpty()) return;
editor.selection.setSelectionRange(range);
selectionMode($end);
Expand Down Expand Up @@ -509,6 +519,12 @@ export default function addTouchListeners(editor, minimal, onclick) {
document.removeEventListener('touchend', touchEnd, config);
}

/**
* Compare two ranges
* @param {AceAjax.Range} r1
* @param {AceAjax.Range} r2
* @returns {boolean}
*/
function compareRanges(r1, r2) {
return r1.start.row === r2.start.row
&& r1.start.column === r2.start.column
Expand All @@ -521,6 +537,7 @@ export default function addTouchListeners(editor, minimal, onclick) {
* @param {number} x
* @param {number} y
* @param {boolean} [shiftKey]
* @param {boolean} [ctrlKey]
*/
function moveCursorTo(x, y, shiftKey = false, ctrlKey = false) {
const pos = renderer.screenToTextCoordinates(x, y);
Expand Down Expand Up @@ -778,6 +795,7 @@ export default function addTouchListeners(editor, minimal, onclick) {
clearTimeout(timeout);
}

timeTouchStart = Date.now();
document.addEventListener('touchmove', teardropTouchMoveHandler, config);
document.addEventListener('touchend', teardropTouchEndHandler, config);
}
Expand All @@ -793,6 +811,22 @@ export default function addTouchListeners(editor, minimal, onclick) {
let y = clientY - (lineHeight * 1.8);
let x = clientX;

if (timeTouchStart) {
timeTouchStart = null;

// Prevents accidental touchmove
const { touchMoveThreshold } = appSettings.value;
if (diffX < touchMoveThreshold && diffY < touchMoveThreshold) return;

const diffX = Math.abs(lastX - clientX);
const diffY = Math.abs(lastY - clientY);
const timeDiff = Date.now() - timeTouchStart;

// Prevents accidental touchmove or highly sensitive touchmove
if (timeDiff < 50) return;
return;
}

if ($activeTeardrop === $cursor) {
const { row, column } = renderer.screenToTextCoordinates(x, y);
editor.gotoLine(row + 1, column);
Expand Down Expand Up @@ -838,13 +872,14 @@ export default function addTouchListeners(editor, minimal, onclick) {

clearTimeout(teardropMoveTimeout);
const parent = $el.getBoundingClientRect();
let dx = 0;
if (clientY < parent.top) dx = -lineHeight;
if (clientY > parent.bottom) dx = lineHeight;
if (dx) {
let deltaX = 0;
if (clientY < parent.top) deltaX = -lineHeight;
if (clientY > parent.bottom) deltaX = lineHeight;

if (deltaX) {
teardropMoveTimeout = setTimeout(() => {
const top = editor.session.getScrollTop();
editor.session.setScrollTop(top + dx);
editor.session.setScrollTop(top + deltaX);
if (teardropTouchEnded) return;
teardropTouchMoveHandler(e);
}, 100);
Expand All @@ -853,7 +888,6 @@ export default function addTouchListeners(editor, minimal, onclick) {
const [left, top] = relativePosition(clientX, clientY - lineHeight);
$activeTeardrop.style.left = `${left}px`;
$activeTeardrop.style.top = `${top}px`;
teardropDoesShowMenu = false;
}

/**
Expand Down Expand Up @@ -901,6 +935,8 @@ export default function addTouchListeners(editor, minimal, onclick) {
*/
function onscrollend() {
editor._emit('scroll-end');
if (!touchEnded) return;

if (selectionActive) {
selectionMode();
}
Expand Down
Loading

0 comments on commit 73bee72

Please sign in to comment.